code:
Set<Pattern> sortedPatterns = new TreeSet<Pattern>();
for(Pattern pattern : project.getPatterns()){
sortedPatterns.add(pattern);
}
project.setPatterns(sortedPatterns);
Then the Pattern need to implements Comparable interface
then finished your method compareTo with your requirement is ok
here is the example:
public int compareTo(Object o) {
// TODO Auto-generated method stub
Pattern pp1 = (Pattern)o;
Pattern pp2 = this;
if(pp2.getType()==null || pp2.getType().equals("")){
return -1;
}
if(pp1.getType()==null || pp1.getType().equals("")){
return 1;
}
return (pp2.getId()).compareTo(pp1.getId());
}
分享到:
相关推荐
- **Polyphase Sort**: A variant of merge sort designed for external sorting. - **Distribution of Initial Runs**: Analysis of initial runs in sorting sequences. #### Recursive Algorithms **...
Figure 2 The initial node and goal node for the tree search algorithm 4.Experimental Requirements 1)The template should be used for all kinds of data type, such as: integer, real, double, etc. in the...
4.3 Heapsort: Fast Sorting via Data Structures 4.4 War Story: Give me a Ticket on an Airplane 4.5 Mergesort: Sorting by Divide-and-Conquer 4.6 Quicksort: Sorting by Randomization 4.7 Distribution...
You will also gain an in-depth knowledge of how hash tables and set data structure function. After this, you will be taught what trees are, and how to use the binary tree and the binary search tree. ...
You can have different set of test cases for each platform - XML export/import of test cases and platforms links - XML export of testplan contents - Private Test plans Test Specification - Test ...
bicliques.- Fast Coupled Path Planning: From Pseudo-Polynomial to Polynomial.- Constant Time Approximation Scheme for Largest Well Predicted Subset.- On Sorting Permutations by Double-Cut-and-Joins.- ...
- Fast search by B-tree indexes. At the moment SQLMemTable is one of the fastest existing in-memory tables for Delphi and C++ Builder. - High-speed memory operations performance is achieved by means ...
8.l Lower bounds for sorting 165 8.2 Counting sort i68 8.3 Radix sort 170 8.4 Bucket sort 174 9 Medians and Order Statistics 183 9.1 Minimum and maximum 184 9.2 Selection in expected linear time 185 ...
Theoretically a b+tree is O(N log k N) or log base k of N, now for the typical values of k which are above 200 for example the b+tree should outperform any binary tree because it will use less ...
Each index row in node pages contains an index key (or set of keys for a composite index) and a pointer to a page at the next level for which the first key value is the same as the key value in the ...
sorting link list list spanning tree tree graph stack hashing deliberate practicing 练习不足、缺陷之处 过程会不舒服 feeback 主动 github LeetCode Sulution Discuss 被动 code review 切题四件套 ...
Sorting 排序算法 Graph 图 Hashing 哈希 Greedy 贪婪算法 Resursion/Backtrace 递归/回溯 Traversal 遍历 前中后序(In-Order/Pre-Order/Post-Order) Breadth-first/Depth-first search 广度优先、深度优先 Divide ...
Sortable is a <s>minimalist</s> JavaScript library for reorderable drag-and-drop lists. Demo: http://rubaxa.github.io/Sortable/ ## Features * Supports touch devices and [modern]...
3. 图论(Graph Theory):涉及到连通分支(Connected Components)、拓扑排序(Topological Sorting)、最小生成树(Minimum Spanning Tree)、最短路径(Shortest Path)、传递闭包(Transitive Closure and ...
of a selected file.<END><br>7 , logging.zip This is a bas that will log installation procedures so the file can be removed later.<END><br>8 , savetree.zip This will save the info in a Tree View....
7. **图论**:连接组件(Connected Components)、拓扑排序(Topological Sorting)、最小生成树(Minimum Spanning Tree)、最短路径(Shortest Path)等,这些概念在网络分析和路由算法中十分关键。 8. **计算...
expapnding/collapsing state of new created elements of the grouping tree. GroupLevels: TGridDataGroupLevelsEh - Collection of group levels. Use this property to create template of the grouping. ...