Skip to content

Commit 3c35e58

Browse files
committed
Merge branch 'master' of github.com:slburson/fset-java
2 parents 435d094 + 3ea342a commit 3c35e58

2 files changed

Lines changed: 20 additions & 4 deletions

File tree

com/ergy/fset/FLinkedHashMap.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
*
2525
* <p>WARNING: <code>less</code> takes O(n) time in this implementation. Avoid it.
2626
*
27-
* <p>Still unimplemented: <code>restrictedTo</code>, <code>restrictedFrom</code>.
27+
* <p>Still unimplemented: user-supplied comparators; <code>restrictedTo</code>,
28+
* <code>restrictedFrom</code>.
2829
*/
2930

3031
public class FLinkedHashMap<Key, Val>
@@ -74,6 +75,13 @@ public int size() {
7475
return FHashMap.treeSize(map_tree);
7576
}
7677

78+
/**
79+
* Returns the keys in the map, in order, as an FList.
80+
*/
81+
public FList<Key> keyList() {
82+
return new FTreeList<Key>(list_tree, null);
83+
}
84+
7785
public Map.Entry<Key, Val> arb() {
7886
return (Map.Entry<Key, Val>)FHashMap.arb(map_tree);
7987
}

com/ergy/fset/FLinkedHashSet.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@
1818

1919

2020
/**
21-
* Just like <code>FHashSet</code> except that the iterator returns entries
22-
* in the same order in which the keys were first added.
21+
* Just like <code>FHashSet</code> except that the iterator returns elements
22+
* in the same order in which they were first added.
2323
*
2424
* <p>WARNING: <code>less</code> takes O(n) time, in general, in this implementation.
2525
* Avoid it, except in the special case of the element just returned by <code>arb</code>.
2626
*
27-
* Still unimplemented: <code>intersection</code>, <code>difference</code>.
27+
* Still unimplemented: user-supplied comparators; <code>intersection</code>,
28+
* <code>difference</code>.
2829
*/
2930

3031
public class FLinkedHashSet<Elt>
@@ -64,6 +65,13 @@ public int size() {
6465
return FHashSet.treeSize(set_tree);
6566
}
6667

68+
/**
69+
* Returns the contents of the set, in order, as an FList.
70+
*/
71+
public FList<Elt> toList() {
72+
return new FTreeList<Elt>(list_tree, null);
73+
}
74+
6775
/**
6876
* On an <code>FLinkedHashSet</code>, always returns the element that was added first.
6977
* (A subsequent call to <code>less</code> passing this element will be efficient.)

0 commit comments

Comments
 (0)