リビジョン | 0be3ba94aeb3fecd1c4c09deb3e95c154e8f2457 (tree) |
---|---|
日時 | 2021-09-09 13:53:30 |
作者 | Nathan Sweet <nathan.sweet@gmai...> |
コミッター | Nathan Sweet |
Better ObjectSet#add javadocs.
@@ -126,7 +126,7 @@ public class IntSet { | ||
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
129 | - /** Returns true if the key was not already in the set. */ | |
129 | + /** Returns true if the key was added to the set or false if it was already in the set. */ | |
130 | 130 | public boolean add (int key) { |
131 | 131 | if (key == 0) { |
132 | 132 | if (hasZeroValue) return false; |
@@ -127,8 +127,8 @@ public class ObjectSet<T> implements Iterable<T> { | ||
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | - /** Returns true if the key was not already in the set. If this set already contains the key, the call leaves the set unchanged | |
131 | - * and returns false. */ | |
130 | + /** Returns true if the key was added to the set or false if it was already in the set. If this set already contains the key, | |
131 | + * the call leaves the set unchanged and returns false. */ | |
132 | 132 | public boolean add (T key) { |
133 | 133 | int i = locateKey(key); |
134 | 134 | if (i >= 0) return false; // Existing key was found. |
@@ -69,8 +69,8 @@ public class OrderedSet<T> extends ObjectSet<T> { | ||
69 | 69 | return true; |
70 | 70 | } |
71 | 71 | |
72 | - /** Sets the key at the specfied index. Returns true if the key was not already in the set. If this set already contains the | |
73 | - * key, the existing key's index is changed if needed and false is returned. */ | |
72 | + /** Sets the key at the specfied index. Returns true if the key was added to the set or false if it was already in the set. If | |
73 | + * this set already contains the key, the existing key's index is changed if needed and false is returned. */ | |
74 | 74 | public boolean add (T key, int index) { |
75 | 75 | if (!super.add(key)) { |
76 | 76 | int oldIndex = items.indexOf(key, true); |