Java Code Examples for java.util.Spliterator#getComparator()
The following examples show how to use
java.util.Spliterator#getComparator() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpliteratorTraversingAndSplittingTest.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void assertSpliterator(Spliterator<?> s) { if (s.hasCharacteristics(Spliterator.SUBSIZED)) { assertTrue(s.hasCharacteristics(Spliterator.SIZED)); } if (s.hasCharacteristics(Spliterator.SIZED)) { assertTrue(s.estimateSize() != Long.MAX_VALUE); assertTrue(s.getExactSizeIfKnown() >= 0); } try { s.getComparator(); assertTrue(s.hasCharacteristics(Spliterator.SORTED)); } catch (IllegalStateException e) { assertFalse(s.hasCharacteristics(Spliterator.SORTED)); } }
Example 2
Source File: SpliteratorTestHelper.java From openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
private static void assertSpliterator(Spliterator<?> s) { if (s.hasCharacteristics(Spliterator.SUBSIZED)) { assertTrue(s.hasCharacteristics(Spliterator.SIZED)); } if (s.hasCharacteristics(Spliterator.SIZED)) { assertTrue(s.estimateSize() != Long.MAX_VALUE); assertTrue(s.getExactSizeIfKnown() >= 0); } try { s.getComparator(); assertTrue(s.hasCharacteristics(Spliterator.SORTED)); } catch (IllegalStateException e) { assertFalse(s.hasCharacteristics(Spliterator.SORTED)); } }
Example 3
Source File: SpliteratorTestHelper.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void assertSpliterator(Spliterator<?> s) { if (s.hasCharacteristics(Spliterator.SUBSIZED)) { assertTrue(s.hasCharacteristics(Spliterator.SIZED)); } if (s.hasCharacteristics(Spliterator.SIZED)) { assertTrue(s.estimateSize() != Long.MAX_VALUE); assertTrue(s.getExactSizeIfKnown() >= 0); } try { s.getComparator(); assertTrue(s.hasCharacteristics(Spliterator.SORTED)); } catch (IllegalStateException e) { assertFalse(s.hasCharacteristics(Spliterator.SORTED)); } }
Example 4
Source File: SpliteratorTestHelper.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void assertSpliterator(Spliterator<?> s) { if (s.hasCharacteristics(Spliterator.SUBSIZED)) { assertTrue(s.hasCharacteristics(Spliterator.SIZED)); } if (s.hasCharacteristics(Spliterator.SIZED)) { assertTrue(s.estimateSize() != Long.MAX_VALUE); assertTrue(s.getExactSizeIfKnown() >= 0); } try { s.getComparator(); assertTrue(s.hasCharacteristics(Spliterator.SORTED)); } catch (IllegalStateException e) { assertFalse(s.hasCharacteristics(Spliterator.SORTED)); } }
Example 5
Source File: SpliteratorCharacteristics.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
void assertISEComparator(Spliterator<?> s) { boolean caught = false; try { s.getComparator(); } catch (IllegalStateException e) { caught = true; } assertTrue(caught, "Throwing IllegalStateException"); }
Example 6
Source File: SpliteratorCharacteristics.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
void assertISEComparator(Spliterator<?> s) { boolean caught = false; try { s.getComparator(); } catch (IllegalStateException e) { caught = true; } assertTrue(caught, "Throwing IllegalStateException"); }
Example 7
Source File: SpliteratorTestHelper.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
private static void assertSpliterator(Spliterator<?> s) { if (s.hasCharacteristics(Spliterator.SUBSIZED)) { assertTrue(s.hasCharacteristics(Spliterator.SIZED)); } if (s.hasCharacteristics(Spliterator.SIZED)) { assertTrue(s.estimateSize() != Long.MAX_VALUE); assertTrue(s.getExactSizeIfKnown() >= 0); } try { s.getComparator(); assertTrue(s.hasCharacteristics(Spliterator.SORTED)); } catch (IllegalStateException e) { assertFalse(s.hasCharacteristics(Spliterator.SORTED)); } }
Example 8
Source File: Collection8Test.java From openjdk-jdk9 with GNU General Public License v2.0 | 5 votes |
/** * Spliterator.getComparator throws IllegalStateException iff the * spliterator does not report SORTED. */ public void testGetComparator_IllegalStateException() { Collection c = impl.emptyCollection(); Spliterator s = c.spliterator(); boolean reportsSorted = s.hasCharacteristics(Spliterator.SORTED); try { s.getComparator(); assertTrue(reportsSorted); } catch (IllegalStateException ex) { assertFalse(reportsSorted); } }
Example 9
Source File: SpliteratorCollisions.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
private static void assertSpliterator(Spliterator<?> s) { if (s.hasCharacteristics(Spliterator.SUBSIZED)) { assertTrue(s.hasCharacteristics(Spliterator.SIZED)); } if (s.hasCharacteristics(Spliterator.SIZED)) { assertTrue(s.estimateSize() != Long.MAX_VALUE); assertTrue(s.getExactSizeIfKnown() >= 0); } try { s.getComparator(); assertTrue(s.hasCharacteristics(Spliterator.SORTED)); } catch (IllegalStateException e) { assertFalse(s.hasCharacteristics(Spliterator.SORTED)); } }
Example 10
Source File: SpliteratorTraversingAndSplittingTest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void assertSpliterator(Spliterator<?> s) { if (s.hasCharacteristics(Spliterator.SUBSIZED)) { assertTrue(s.hasCharacteristics(Spliterator.SIZED)); } if (s.hasCharacteristics(Spliterator.SIZED)) { assertTrue(s.estimateSize() != Long.MAX_VALUE); assertTrue(s.getExactSizeIfKnown() >= 0); } try { s.getComparator(); assertTrue(s.hasCharacteristics(Spliterator.SORTED)); } catch (IllegalStateException e) { assertFalse(s.hasCharacteristics(Spliterator.SORTED)); } }
Example 11
Source File: SpliteratorCollisions.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private static void assertSpliterator(Spliterator<?> s) { if (s.hasCharacteristics(Spliterator.SUBSIZED)) { assertTrue(s.hasCharacteristics(Spliterator.SIZED)); } if (s.hasCharacteristics(Spliterator.SIZED)) { assertTrue(s.estimateSize() != Long.MAX_VALUE); assertTrue(s.getExactSizeIfKnown() >= 0); } try { s.getComparator(); assertTrue(s.hasCharacteristics(Spliterator.SORTED)); } catch (IllegalStateException e) { assertFalse(s.hasCharacteristics(Spliterator.SORTED)); } }
Example 12
Source File: SpliteratorCharacteristics.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
void assertISEComparator(Spliterator<?> s) { boolean caught = false; try { s.getComparator(); } catch (IllegalStateException e) { caught = true; } assertTrue(caught, "Throwing IllegalStateException"); }
Example 13
Source File: SpliteratorCollisions.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void assertSpliterator(Spliterator<?> s) { if (s.hasCharacteristics(Spliterator.SUBSIZED)) { assertTrue(s.hasCharacteristics(Spliterator.SIZED)); } if (s.hasCharacteristics(Spliterator.SIZED)) { assertTrue(s.estimateSize() != Long.MAX_VALUE); assertTrue(s.getExactSizeIfKnown() >= 0); } try { s.getComparator(); assertTrue(s.hasCharacteristics(Spliterator.SORTED)); } catch (IllegalStateException e) { assertFalse(s.hasCharacteristics(Spliterator.SORTED)); } }
Example 14
Source File: SpliteratorCollisions.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private static void assertSpliterator(Spliterator<?> s) { if (s.hasCharacteristics(Spliterator.SUBSIZED)) { assertTrue(s.hasCharacteristics(Spliterator.SIZED)); } if (s.hasCharacteristics(Spliterator.SIZED)) { assertTrue(s.estimateSize() != Long.MAX_VALUE); assertTrue(s.getExactSizeIfKnown() >= 0); } try { s.getComparator(); assertTrue(s.hasCharacteristics(Spliterator.SORTED)); } catch (IllegalStateException e) { assertFalse(s.hasCharacteristics(Spliterator.SORTED)); } }
Example 15
Source File: SpliteratorTestHelper.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
private static void assertSpliterator(Spliterator<?> s) { if (s.hasCharacteristics(Spliterator.SUBSIZED)) { assertTrue(s.hasCharacteristics(Spliterator.SIZED)); } if (s.hasCharacteristics(Spliterator.SIZED)) { assertTrue(s.estimateSize() != Long.MAX_VALUE); assertTrue(s.getExactSizeIfKnown() >= 0); } try { s.getComparator(); assertTrue(s.hasCharacteristics(Spliterator.SORTED)); } catch (IllegalStateException e) { assertFalse(s.hasCharacteristics(Spliterator.SORTED)); } }
Example 16
Source File: StreamOpFlag.java From openjdk-jdk9 with GNU General Public License v2.0 | 3 votes |
/** * Converts a spliterator characteristic bit set to stream flags. * * @implSpec * If the spliterator is naturally {@code SORTED} (the associated * {@code Comparator} is {@code null}) then the characteristic is converted * to the {@link #SORTED} flag, otherwise the characteristic is not * converted. * * @param spliterator the spliterator from which to obtain characteristic * bit set. * @return the stream flags. */ static int fromCharacteristics(Spliterator<?> spliterator) { int characteristics = spliterator.characteristics(); if ((characteristics & Spliterator.SORTED) != 0 && spliterator.getComparator() != null) { // Do not propagate the SORTED characteristic if it does not correspond // to a natural sort order return characteristics & SPLITERATOR_CHARACTERISTICS_MASK & ~Spliterator.SORTED; } else { return characteristics & SPLITERATOR_CHARACTERISTICS_MASK; } }
Example 17
Source File: StreamOpFlag.java From TencentKona-8 with GNU General Public License v2.0 | 3 votes |
/** * Converts a spliterator characteristic bit set to stream flags. * * @implSpec * If the spliterator is naturally {@code SORTED} (the associated * {@code Comparator} is {@code null}) then the characteristic is converted * to the {@link #SORTED} flag, otherwise the characteristic is not * converted. * * @param spliterator the spliterator from which to obtain characteristic * bit set. * @return the stream flags. */ static int fromCharacteristics(Spliterator<?> spliterator) { int characteristics = spliterator.characteristics(); if ((characteristics & Spliterator.SORTED) != 0 && spliterator.getComparator() != null) { // Do not propagate the SORTED characteristic if it does not correspond // to a natural sort order return characteristics & SPLITERATOR_CHARACTERISTICS_MASK & ~Spliterator.SORTED; } else { return characteristics & SPLITERATOR_CHARACTERISTICS_MASK; } }
Example 18
Source File: StreamOpFlag.java From JDKSourceCode1.8 with MIT License | 3 votes |
/** * Converts a spliterator characteristic bit set to stream flags. * * @implSpec * If the spliterator is naturally {@code SORTED} (the associated * {@code Comparator} is {@code null}) then the characteristic is converted * to the {@link #SORTED} flag, otherwise the characteristic is not * converted. * * @param spliterator the spliterator from which to obtain characteristic * bit set. * @return the stream flags. */ static int fromCharacteristics(Spliterator<?> spliterator) { int characteristics = spliterator.characteristics(); if ((characteristics & Spliterator.SORTED) != 0 && spliterator.getComparator() != null) { // Do not propagate the SORTED characteristic if it does not correspond // to a natural sort order return characteristics & SPLITERATOR_CHARACTERISTICS_MASK & ~Spliterator.SORTED; } else { return characteristics & SPLITERATOR_CHARACTERISTICS_MASK; } }
Example 19
Source File: StreamOpFlag.java From openjdk-jdk8u with GNU General Public License v2.0 | 3 votes |
/** * Converts a spliterator characteristic bit set to stream flags. * * @implSpec * If the spliterator is naturally {@code SORTED} (the associated * {@code Comparator} is {@code null}) then the characteristic is converted * to the {@link #SORTED} flag, otherwise the characteristic is not * converted. * * @param spliterator the spliterator from which to obtain characteristic * bit set. * @return the stream flags. */ static int fromCharacteristics(Spliterator<?> spliterator) { int characteristics = spliterator.characteristics(); if ((characteristics & Spliterator.SORTED) != 0 && spliterator.getComparator() != null) { // Do not propagate the SORTED characteristic if it does not correspond // to a natural sort order return characteristics & SPLITERATOR_CHARACTERISTICS_MASK & ~Spliterator.SORTED; } else { return characteristics & SPLITERATOR_CHARACTERISTICS_MASK; } }
Example 20
Source File: StreamOpFlag.java From dragonwell8_jdk with GNU General Public License v2.0 | 3 votes |
/** * Converts a spliterator characteristic bit set to stream flags. * * @implSpec * If the spliterator is naturally {@code SORTED} (the associated * {@code Comparator} is {@code null}) then the characteristic is converted * to the {@link #SORTED} flag, otherwise the characteristic is not * converted. * * @param spliterator the spliterator from which to obtain characteristic * bit set. * @return the stream flags. */ static int fromCharacteristics(Spliterator<?> spliterator) { int characteristics = spliterator.characteristics(); if ((characteristics & Spliterator.SORTED) != 0 && spliterator.getComparator() != null) { // Do not propagate the SORTED characteristic if it does not correspond // to a natural sort order return characteristics & SPLITERATOR_CHARACTERISTICS_MASK & ~Spliterator.SORTED; } else { return characteristics & SPLITERATOR_CHARACTERISTICS_MASK; } }