/libcore/ojluni/src/main/java/java/util/function/ |
H A D | BinaryOperator.java | 51 * @param <T> the type of the input arguments of the comparator 52 * @param comparator a {@code Comparator} for comparing the two values 57 public static <T> BinaryOperator<T> minBy(Comparator<? super T> comparator) { argument 58 Objects.requireNonNull(comparator); 59 return (a, b) -> comparator.compare(a, b) <= 0 ? a : b; 66 * @param <T> the type of the input arguments of the comparator 67 * @param comparator a {@code Comparator} for comparing the two values 72 public static <T> BinaryOperator<T> maxBy(Comparator<? super T> comparator) { argument 73 Objects.requireNonNull(comparator); 74 return (a, b) -> comparator [all...] |
/libcore/luni/src/test/java/libcore/java/util/ |
H A D | ComparatorTest.java | 43 private <T> void checkComparison(Comparator<T> comparator, T[] items) { argument 45 assertEquals(0, comparator.compare(items[i], items[i])); 47 assertTrue(comparator.compare(items[i], items[j]) < 0); 48 assertTrue(comparator.compare(items[j], items[i]) > 0); 54 Comparator<Item> comparator = Comparator.comparingDouble(Item::getOrderAsDouble); 55 checkComparison(comparator, orderedItems); 59 Comparator<Item> comparator = Comparator.comparingInt(Item::getOrderAsInt); 60 checkComparison(comparator, orderedItems); 64 Comparator<Item> comparator = Comparator.comparingLong(Item::getOrderAsLong); 65 checkComparison(comparator, orderedItem [all...] |
H A D | SpliteratorTester.java | 53 ArrayList<T> expectedElements, Comparator<T> comparator) { 63 Collections.sort(expectedElements, comparator); 64 Collections.sort(recorder, comparator); 105 ArrayList<T> expectedElements, Comparator<T> comparator) { 137 Collections.sort(expectedElements, comparator); 138 Collections.sort(recorder, comparator); 150 ArrayList<T> expectedElements, Comparator<T> comparator) { 151 runBasicSplitTests(spliterable.spliterator(), expectedElements, comparator); 222 public static <T> void runSortedTests(Iterable<T> spliterable, Comparator<T> comparator) { argument 230 Collections.sort(sortedElements, comparator); 52 runBasicIterationTests_unordered(Spliterator<T> spliterator, ArrayList<T> expectedElements, Comparator<T> comparator) argument 104 runBasicSplitTests(Spliterator<T> spliterator, ArrayList<T> expectedElements, Comparator<T> comparator) argument 149 runBasicSplitTests(Iterable<T> spliterable, ArrayList<T> expectedElements, Comparator<T> comparator) argument [all...] |
H A D | TreeSetTest.java | 44 assertEquals(0, deserialized.comparator().compare("X", "x")); 104 * comparator. http://b/5552608 132 assertEquals(0, deserialized.comparator().compare("X", "x"));
|
/libcore/ojluni/src/main/java/java/util/ |
H A D | SortedSet.java | 38 * interface (or be accepted by the specified comparator). Furthermore, all 40 * (or <tt>comparator.compare(e1, e2)</tt>) must not throw a 47 * explicit comparator is provided) must be <i>consistent with equals</i> if 64 * sorted set sorted according to the specified comparator. 3) A 110 * Returns the comparator used to order the elements in this set, 114 * @return the comparator used to order the elements in this set, 118 Comparator<? super E> comparator(); method in interface:SortedSet 138 * set's comparator (or, if the set has no comparator, using 167 * with this set's comparator (o [all...] |
H A D | PriorityQueue.java | 92 * priority queue is ordered by comparator, or by the elements' 93 * natural ordering, if comparator is null: For each node n in the 105 * The comparator, or null if priority queue uses elements' 108 private final Comparator<? super E> comparator; field in class:PriorityQueue 140 * whose elements are ordered according to the specified comparator. 142 * @param comparator the comparator that will be used to order this 147 public PriorityQueue(Comparator<? super E> comparator) { argument 148 this(DEFAULT_INITIAL_CAPACITY, comparator); 153 * that orders its elements according to the specified comparator 162 PriorityQueue(int initialCapacity, Comparator<? super E> comparator) argument 748 public Comparator<? super E> comparator() { method in class:PriorityQueue [all...] |
H A D | SortedMap.java | 39 * interface (or be accepted by the specified comparator). Furthermore, all 41 * {@code comparator.compare(k1, k2)}) must not throw a 48 * explicit comparator is provided) must be <em>consistent with equals</em> if 68 * creates an empty sorted map sorted according to the specified comparator.</li> 115 * Returns the comparator used to order the keys in this map, or 119 * @return the comparator used to order the keys in this map, 123 Comparator<? super K> comparator(); method in interface:SortedMap 142 * cannot be compared to one another using this map's comparator 143 * (or, if the map has no comparator, using natural ordering). 170 * with this map's comparator (o [all...] |
H A D | TreeSet.java | 38 * comparator is provided) must be <i>consistent with equals</i> if it is to 129 * comparator. All elements inserted into the set must be <i>mutually 130 * comparable</i> by the specified comparator: {@code comparator.compare(e1, 136 * @param comparator the comparator that will be used to order this set. 140 public TreeSet(Comparator<? super E> comparator) { argument 141 this(new TreeMap<>(comparator)); 171 this(s.comparator()); 230 * and this set uses natural ordering, or its comparator 386 public Comparator<? super E> comparator() { method in class:TreeSet [all...] |
H A D | Comparator.java | 45 * The ordering imposed by a comparator <tt>c</tt> on a set of elements 51 * Caution should be exercised when using a comparator capable of imposing an 53 * Suppose a sorted set (or sorted map) with an explicit comparator <tt>c</tt> 62 * to an empty {@code TreeSet} with comparator {@code c}. 72 * order for the data structure to serialize successfully, the comparator (if 76 * <i>imposed ordering</i> that a given comparator <tt>c</tt> imposes on a 92 * <p>Unlike {@code Comparable}, a comparator may optionally permit 100 * @param <T> the type of objects that may be compared by this comparator 136 * any comparator that violates this condition should clearly indicate 137 * this fact. The recommended language is "Note: this comparator 377 nullsFirst(Comparator<? super T> comparator) argument 398 nullsLast(Comparator<? super T> comparator) argument [all...] |
H A D | TreeMap.java | 46 * whether or not an explicit comparator is provided, must be <em>consistent 117 * The comparator used to maintain order in this tree map, or 122 private final Comparator<? super K> comparator; field in class:TreeMap 149 comparator = null; 154 * comparator. All keys inserted into the map must be <em>mutually 155 * comparable</em> by the given comparator: {@code comparator.compare(k1, 162 * @param comparator the comparator that will be used to order this map. 166 public TreeMap(Comparator<? super K> comparator) { argument 283 public Comparator<? super K> comparator() { method in class:TreeMap 1166 public Comparator<? super E> comparator() { return m.comparator(); } method in class:TreeMap.KeySet 1884 public Comparator<? super K> comparator() { method in class:TreeMap.AscendingSubMap 1979 public Comparator<? super K> comparator() { method in class:TreeMap.DescendingSubMap 2085 public Comparator<? super K> comparator() { throw new InternalError(); } method in class:TreeMap.SubMap [all...] |
/libcore/luni/src/test/java/org/apache/harmony/luni/tests/java/net/ |
H A D | HttpRetryExceptionTest.java | 34 // comparator for HttpRetryException objects 35 private static final SerializableAssert comparator = new SerializableAssert() { field in class:HttpRetryExceptionTest 53 LOCATION), comparator); 61 100, LOCATION), comparator);
|
/libcore/luni/src/main/java/libcore/util/ |
H A D | CollectionUtils.java | 83 * not use {@link Object#equals}: only the comparator defines equality. 85 public static <T> void removeDuplicates(List<T> list, Comparator<? super T> comparator) { argument 86 Collections.sort(list, comparator); 89 if (comparator.compare(list.get(j - 1), list.get(i)) != 0) {
|
/libcore/ojluni/src/main/java/java/util/stream/ |
H A D | SortedOps.java | 59 * @param comparator the comparator to order elements by 62 Comparator<? super T> comparator) { 63 return new OfRef<>(upstream, comparator); 104 private final Comparator<? super T> comparator; field in class:SortedOps.OfRef 117 this.comparator = comp; 121 * Sort using the provided comparator. 123 * @param comparator The comparator to be used to evaluate ordering. 125 OfRef(AbstractPipeline<?, T, ?> upstream, Comparator<? super T> comparator) { argument 61 makeRef(AbstractPipeline<?, T, ?> upstream, Comparator<? super T> comparator) argument 305 protected final Comparator<? super T> comparator; field in class:SortedOps.AbstractRefSortingSink 309 AbstractRefSortingSink(Sink<? super T> downstream, Comparator<? super T> comparator) argument 334 SizedRefSortingSink(Sink<? super T> sink, Comparator<? super T> comparator) argument 374 RefSortingSink(Sink<? super T> sink, Comparator<? super T> comparator) argument [all...] |
H A D | Stream.java | 384 * @param comparator a <a href="package-summary.html#NonInterference">non-interfering</a>, 389 Stream<T> sorted(Comparator<? super T> comparator); argument 813 * @param comparator a <a href="package-summary.html#NonInterference">non-interfering</a>, 820 Optional<T> min(Comparator<? super T> comparator); argument 830 * @param comparator a <a href="package-summary.html#NonInterference">non-interfering</a>, 837 Optional<T> max(Comparator<? super T> comparator); argument
|
H A D | ReferencePipeline.java | 394 public final Stream<P_OUT> sorted(Comparator<? super P_OUT> comparator) { argument 395 return SortedOps.makeRef(this, comparator); 515 public final Optional<P_OUT> max(Comparator<? super P_OUT> comparator) { argument 516 return reduce(BinaryOperator.maxBy(comparator)); 520 public final Optional<P_OUT> min(Comparator<? super P_OUT> comparator) { argument 521 return reduce(BinaryOperator.minBy(comparator));
|
/libcore/luni/src/main/java/java/util/concurrent/ |
H A D | PriorityBlockingQueue.java | 116 * priority queue is ordered by comparator, or by the elements' 117 * natural ordering, if comparator is null: For each node n in the 129 * The comparator, or null if priority queue uses elements' 132 private transient Comparator<? super E> comparator; field in class:PriorityBlockingQueue 181 * comparator. 184 * @param comparator the comparator that will be used to order this 191 Comparator<? super E> comparator) { 196 this.comparator = comparator; 190 PriorityBlockingQueue(int initialCapacity, Comparator<? super E> comparator) argument 559 public Comparator<? super E> comparator() { method in class:PriorityBlockingQueue [all...] |
H A D | ConcurrentSkipListSet.java | 90 * the specified comparator. 92 * @param comparator the comparator that will be used to order this set. 96 public ConcurrentSkipListSet(Comparator<? super E> comparator) { argument 97 m = new ConcurrentSkipListMap<E,Object>(comparator); 125 m = new ConcurrentSkipListMap<E,Object>(s.comparator()); 361 public Comparator<? super E> comparator() { method in class:ConcurrentSkipListSet 362 return m.comparator(); 446 * {@link Collections#reverseOrder(Comparator) Collections.reverseOrder}{@code (comparator())}. 465 * <p>The spliterator's comparator (se [all...] |
H A D | ConcurrentSkipListMap.java | 297 * handle infusing comparator-vs-comparable choice into search 298 * loops. Static method cpr(comparator, x, y) is used for all 299 * comparisons, which works well as long as the comparator 341 * The comparator used to maintain order in this map, or null if 346 final Comparator<? super K> comparator; field in class:ConcurrentSkipListMap 360 * (Note that comparator must be separately initialized.) 616 * Compares using comparator or natural ordering if null. 709 Comparator<? super K> cmp = comparator; 745 Comparator<? super K> cmp = comparator; 787 Comparator<? super K> cmp = comparator; 1262 ConcurrentSkipListMap(Comparator<? super K> comparator) argument 1992 public Comparator<? super K> comparator() { method in class:ConcurrentSkipListMap 2343 public Comparator<? super K> comparator() { return m.comparator(); } method in class:ConcurrentSkipListMap.KeySet 2877 public Comparator<? super K> comparator() { method in class:ConcurrentSkipListMap.SubMap 3276 final Comparator<? super K> comparator; field in class:ConcurrentSkipListMap.CSLMSpliterator 3281 CSLMSpliterator(Comparator<? super K> comparator, Index<K,V> row, Node<K,V> origin, K fence, int est) argument 3292 KeySpliterator(Comparator<? super K> comparator, Index<K,V> row, Node<K,V> origin, K fence, int est) argument 3380 ValueSpliterator(Comparator<? super K> comparator, Index<K,V> row, Node<K,V> origin, K fence, int est) argument 3467 EntrySpliterator(Comparator<? super K> comparator, Index<K,V> row, Node<K,V> origin, K fence, int est) argument [all...] |
/libcore/support/src/test/java/org/apache/harmony/testframework/serialization/ |
H A D | SerializationTest.java | 185 // default comparator for a class that has equals(Object) method 252 * Returns <code>comparator</code> for provided serializable 255 * The <code>comparator</code> is searched in the following order: <br> 257 * selected as </code>comparator</code>.<br>- if passed <code>object</code> 267 * @return object's comparator 279 // use default comparator 283 // TODO use generics to detect comparator 291 throw new RuntimeException("Failed to detect comparator"); 313 * <code>object</code> using specified <code>comparator</code>. 317 * @param comparator 319 verifyGolden(TestCase test, Object object, SerializableAssert comparator) argument 356 verifyGolden(TestCase test, Object[] objects, SerializableAssert comparator) argument 386 verifySelf(Object object, SerializableAssert comparator) argument 415 verifySelf(Object[] objects, SerializableAssert comparator) argument [all...] |
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ |
H A D | RefSortedMap.java | 88 private final Comparator<? super K> comparator; field in class:RefSortedMap 166 public Comparator<? super K> comparator() { method in class:RefSortedMap.SubMap 167 return RefSortedMap.this.comparator(); 246 return comparator != null ? comparator.compare(start, end) 251 public RefSortedMap(Comparator<? super K> comparator) { argument 252 this.comparator = comparator; 262 this(map.comparator()); 266 public Comparator<? super K> comparator() { method in class:RefSortedMap [all...] |
H A D | PriorityQueueTest.java | 147 // Try removing an entry that the comparator says is equal 201 assertNull(queue.comparator()); 211 assertNull(queue.comparator()); 222 assertNull(queue.comparator()); 224 MockComparator<Object> comparator = new MockComparator<Object>(); 225 queue = new PriorityQueue<Object>(100, comparator); 228 assertEquals(comparator, queue.comparator()); 259 assertEquals(objectComparator, integerQueue.comparator()); 275 assertNull(integerQueue.comparator()); [all...] |
H A D | SortedMapTestBase.java | 183 assertEquals(ref.comparator(), map.comparator()); 208 if (ref.comparator() != null && 209 ref.comparator().compare(key0, key1) > 0) { 219 if (ref.comparator() != null && ref.comparator().compare(100, 0) < 0) {
|
H A D | HashSetTest.java | 218 SerializationTest.verifySelf(hs, comparator); 219 SerializationTest.verifyGolden(this, hs, comparator); 307 private static final SerializationTest.SerializableAssert comparator = new field in class:HashSetTest
|
H A D | RandomTest.java | 312 SerializationTest.verifyGolden(this, rand, comparator); 316 SerializationTest.verifySelf(rand, comparator); 319 public static final SerializationTest.SerializableAssert comparator = field in class:RandomTest
|
/libcore/ojluni/src/main/java/java/net/ |
H A D | InMemoryCookieStore.java | 303 // @param comparator the prediction to decide whether or not 307 T comparator) 311 if ((index == comparator) || (index != null && comparator.compareTo(index) == 0)) { 328 } // end of comparator.compareTo(index) == 0 306 getInternal2(List<HttpCookie> cookies, Map<T, List<HttpCookie>> cookieIndex, T comparator) argument
|