/libcore/ojluni/src/main/java/java/lang/reflect/ |
D | Array.java | 129 public static int getLength(Object array) { in getLength() argument 130 if (array instanceof Object[]) { in getLength() 131 return ((Object[]) array).length; in getLength() 132 } else if (array instanceof boolean[]) { in getLength() 133 return ((boolean[]) array).length; in getLength() 134 } else if (array instanceof byte[]) { in getLength() 135 return ((byte[]) array).length; in getLength() 136 } else if (array instanceof char[]) { in getLength() 137 return ((char[]) array).length; in getLength() 138 } else if (array instanceof double[]) { in getLength() [all …]
|
/libcore/json/src/test/java/org/json/ |
D | JSONArrayTest.java | 31 JSONArray array = new JSONArray(); in testEmptyArray() local 32 assertEquals(0, array.length()); in testEmptyArray() 33 assertEquals("", array.join(" AND ")); in testEmptyArray() 35 array.get(0); in testEmptyArray() 40 array.getBoolean(0); in testEmptyArray() 45 assertEquals("[]", array.toString()); in testEmptyArray() 46 assertEquals("[]", array.toString(4)); in testEmptyArray() 49 assertTrue(array.isNull(0)); in testEmptyArray() 50 assertNull(array.opt(0)); in testEmptyArray() 51 assertFalse(array.optBoolean(0)); in testEmptyArray() [all …]
|
D | ParsingTest.java | 150 assertParsed(array(), "[]"); in testParsingArrays() 151 assertParsed(array(5, 6, true), "[5,6,true]"); in testParsingArrays() 152 assertParsed(array(5, 6, array()), "[5,6,[]]"); in testParsingArrays() 153 assertParsed(array(5, 6, 7), "[5;6;7]"); in testParsingArrays() 154 assertParsed(array(5, 6, 7), "[5 , 6 \t; \r\n 7\n]"); in testParsingArrays() 155 assertParsed(array(5, 6, 7, null), "[5,6,7,]"); in testParsingArrays() 156 assertParsed(array(null, null), "[,]"); in testParsingArrays() 157 assertParsed(array(5, null, null, null, 5), "[5,,,,5]"); in testParsingArrays() 158 assertParsed(array(null, 5), "[,5]"); in testParsingArrays() 159 assertParsed(array(null, null, null), "[,,]"); in testParsingArrays() [all …]
|
/libcore/luni/src/test/java/libcore/java/util/ |
D | OldAndroidArrayListTest.java | 30 ArrayList array = new ArrayList(); in testArrayList() local 31 assertEquals(0, array.size()); in testArrayList() 32 assertTrue(array.isEmpty()); in testArrayList() 34 array.add(new Integer(0)); in testArrayList() 35 array.add(0, new Integer(1)); in testArrayList() 36 array.add(1, new Integer(2)); in testArrayList() 37 array.add(new Integer(3)); in testArrayList() 38 array.add(new Integer(1)); in testArrayList() 40 assertEquals(5, array.size()); in testArrayList() 41 assertFalse(array.isEmpty()); in testArrayList() [all …]
|
/libcore/benchmarks/src/benchmarks/ |
D | DeepArrayOpsBenchmark.java | 27 private Object[] array; field in DeepArrayOpsBenchmark 34 array = new Object[arrayLength * 13]; in setUp() 37 array[i] = new IntWrapper(i); in setUp() 40 array[i + 1] = new16ElementObjectarray(); in setUp() 43 array[i + 2] = new boolean[16]; in setUp() 46 array[i + 3] = new byte[16]; in setUp() 49 array[i + 4] = new char[16]; in setUp() 52 array[i + 5] = new short[16]; in setUp() 55 array[i + 6] = new float[16]; in setUp() 58 array[i + 7] = new long[16]; in setUp() [all …]
|
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/util/ |
D | PriorityQueueTest.java | 46 Integer[] array = { 2, 45, 7, -12, 9 }; in test_iterator() local 47 for (int i = 0; i < array.length; i++) { in test_iterator() 48 integerQueue.offer(array[i]); in test_iterator() 57 Arrays.sort(array); in test_iterator() 59 assertTrue(Arrays.equals(array, resultArray)); in test_iterator() 115 Integer[] array = { 2, 45, 7, -12, 9 }; in test_iterator_remove() local 116 for (int i = 0; i < array.length; i++) { in test_iterator_remove() 117 integerQueue.offer(array[i]); in test_iterator_remove() 121 for (int i = 0; i < array.length; i++) { in test_iterator_remove() 127 assertEquals(array.length - 1, integerQueue.size()); in test_iterator_remove() [all …]
|
/libcore/ojluni/src/test/java/util/stream/boottest/java/util/stream/ |
D | IntNodeTest.java | 43 int[] array = new int[size]; in createSizes() local 44 for (int i = 0; i < array.length; i++) { in createSizes() 45 array[i] = i; in createSizes() 50 nodes.add(Nodes.node(array)); in createSizes() 51 nodes.add(degenerateTree(Spliterators.iterator(Arrays.spliterator(array)))); in createSizes() 52 nodes.add(tree(toList(array), l -> Nodes.node(toIntArray(l)))); in createSizes() 53 nodes.add(fill(array, Nodes.intBuilder(array.length))); in createSizes() 54 nodes.add(fill(array, Nodes.intBuilder())); in createSizes() 57 params.add(new Object[]{array, node}); in createSizes() 65 private static void assertEqualsListIntArray(List<Integer> list, int[] array) { in assertEqualsListIntArray() argument [all …]
|
D | LongNodeTest.java | 43 long[] array = new long[size]; in createSizes() local 44 for (int i = 0; i < array.length; i++) { in createSizes() 45 array[i] = i; in createSizes() 50 nodes.add(Nodes.node(array)); in createSizes() 51 nodes.add(degenerateTree(Spliterators.iterator(Arrays.spliterator(array)))); in createSizes() 52 nodes.add(tree(toList(array), l -> Nodes.node(toLongArray(l)))); in createSizes() 53 nodes.add(fill(array, Nodes.longBuilder(array.length))); in createSizes() 54 nodes.add(fill(array, Nodes.longBuilder())); in createSizes() 57 params.add(new Object[]{array, node}); in createSizes() 65 private static void assertEqualsListLongArray(List<Long> list, long[] array) { in assertEqualsListLongArray() argument [all …]
|
D | DoubleNodeTest.java | 43 double[] array = new double[size]; in createSizes() local 44 for (int i = 0; i < array.length; i++) { in createSizes() 45 array[i] = i; in createSizes() 50 nodes.add(Nodes.node(array)); in createSizes() 51 nodes.add(degenerateTree(Spliterators.iterator(Arrays.spliterator(array)))); in createSizes() 52 nodes.add(tree(toList(array), l -> Nodes.node(toDoubleArray(l)))); in createSizes() 53 nodes.add(fill(array, Nodes.doubleBuilder(array.length))); in createSizes() 54 nodes.add(fill(array, Nodes.doubleBuilder())); in createSizes() 57 params.add(new Object[]{array, node}); in createSizes() 65 private static void assertEqualsListDoubleArray(List<Double> list, double[] array) { in assertEqualsListDoubleArray() argument [all …]
|
D | NodeTest.java | 43 Integer[] array = new Integer[size]; in createSizes() local 44 for (int i = 0; i < array.length; i++) { in createSizes() 45 array[i] = i; in createSizes() 49 nodes.add(Nodes.node(array)); in createSizes() 50 nodes.add(Nodes.node(Arrays.asList(array))); in createSizes() 51 nodes.add(degenerateTree(Arrays.asList(array).iterator())); in createSizes() 52 … nodes.add(tree(Arrays.asList(array), l -> Nodes.node(l.toArray(new Integer[l.size()])))); in createSizes() 53 nodes.add(tree(Arrays.asList(array), l -> Nodes.node(l))); in createSizes() 54 … nodes.add(fill(array, Nodes.builder(array.length, LambdaTestHelpers.integerArrayGenerator))); in createSizes() 55 nodes.add(fill(array, Nodes.builder())); in createSizes() [all …]
|
D | SpinedBufferTest.java | 65 int[] array = IntStream.range(0, size).toArray(); in createSpinedBuffer() local 68 Arrays.stream(array).boxed().forEach(sb); in createSpinedBuffer() 69 params.add(new Object[]{array, sb}); in createSpinedBuffer() 72 Arrays.stream(array).boxed().forEach(sb); in createSpinedBuffer() 73 params.add(new Object[]{array, sb}); in createSpinedBuffer() 76 Arrays.stream(array).boxed().forEach(sb); in createSpinedBuffer() 77 params.add(new Object[]{array, sb}); in createSpinedBuffer() 80 Arrays.stream(array).boxed().forEach(sb); in createSpinedBuffer() 81 params.add(new Object[]{array, sb}); in createSpinedBuffer() 88 public void testSpliterator(int[] array, SpinedBuffer<Integer> sb) { in testSpliterator() argument [all …]
|
/libcore/ojluni/src/main/java/java/util/stream/ |
D | Nodes.java | 139 static <T> Node<T> node(T[] array) { in node() argument 140 return new ArrayNode<>(array); in node() 192 static Node.OfInt node(int[] array) { in node() argument 193 return new IntArrayNode(array); in node() 229 static Node.OfLong node(final long[] array) { in node() argument 230 return new LongArrayNode(array); in node() 266 static Node.OfDouble node(final double[] array) { in node() argument 267 return new DoubleArrayNode(array); in node() 324 P_OUT[] array = generator.apply((int) size); in collect() local 325 new SizedCollectorTask.OfRef<>(spliterator, helper, array).invoke(); in collect() [all …]
|
/libcore/luni/src/main/java/java/util/concurrent/ |
D | PriorityBlockingQueue.java | 259 private void tryGrow(Object[] array, int oldCap) { in tryGrow() argument 274 if (newCap > oldCap && queue == array) in tryGrow() 283 if (newArray != null && queue == array) { in tryGrow() 285 System.arraycopy(array, 0, newArray, 0, oldCap); in tryGrow() 297 Object[] array = queue; in dequeue() local 298 E result = (E) array[0]; in dequeue() 299 E x = (E) array[n]; in dequeue() 300 array[n] = null; in dequeue() 303 siftDownComparable(0, x, array, n); in dequeue() 305 siftDownUsingComparator(0, x, array, n, cmp); in dequeue() [all …]
|
/libcore/harmony-tests/src/test/java/org/apache/harmony/tests/java/nio/ |
D | LongBufferTest.java | 51 long array[] = buf.array(); in testArray() local 52 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 54 loadTestData1(array, buf.arrayOffset(), buf.capacity()); in testArray() 55 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 57 loadTestData2(array, buf.arrayOffset(), buf.capacity()); in testArray() 58 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 61 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 64 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 68 long array[] = buf.array(); in testArrayOffset() local 69 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArrayOffset() [all …]
|
D | IntBufferTest.java | 51 int array[] = buf.array(); in testArray() local 52 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 54 loadTestData1(array, buf.arrayOffset(), buf.capacity()); in testArray() 55 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 57 loadTestData2(array, buf.arrayOffset(), buf.capacity()); in testArray() 58 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 61 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 64 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 68 int array[] = buf.array(); in testArrayOffset() local 69 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArrayOffset() [all …]
|
D | FloatBufferTest.java | 51 float array[] = buf.array(); in testArray() local 52 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 54 loadTestData1(array, buf.arrayOffset(), buf.capacity()); in testArray() 55 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 57 loadTestData2(array, buf.arrayOffset(), buf.capacity()); in testArray() 58 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 61 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 64 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 68 float array[] = buf.array(); in testArrayOffset() local 69 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArrayOffset() [all …]
|
D | DoubleBufferTest.java | 75 double array[] = buf.array(); in testArray() local 76 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 78 loadTestData1(array, buf.arrayOffset(), buf.capacity()); in testArray() 79 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 81 loadTestData2(array, buf.arrayOffset(), buf.capacity()); in testArray() 82 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 85 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 88 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 92 double array[] = buf.array(); in testArrayOffset() local 93 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArrayOffset() [all …]
|
D | ShortBufferTest.java | 50 short array[] = buf.array(); in testArray() local 51 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 53 loadTestData1(array, buf.arrayOffset(), buf.capacity()); in testArray() 54 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 56 loadTestData2(array, buf.arrayOffset(), buf.capacity()); in testArray() 57 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 60 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 63 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArray() 67 short array[] = buf.array(); in testArrayOffset() local 68 assertContentEquals(buf, array, buf.arrayOffset(), buf.capacity()); in testArrayOffset() [all …]
|
D | WrappedDoubleBufferTest.java | 39 double array[] = new double[20]; in testWrappedDoubleuffer_IllegalArg() local 41 DoubleBuffer.wrap(array, -1, 0); in testWrappedDoubleuffer_IllegalArg() 47 DoubleBuffer.wrap(array, 21, 0); in testWrappedDoubleuffer_IllegalArg() 53 DoubleBuffer.wrap(array, 0, -1); in testWrappedDoubleuffer_IllegalArg() 59 DoubleBuffer.wrap(array, 0, 21); in testWrappedDoubleuffer_IllegalArg() 65 DoubleBuffer.wrap(array, Integer.MAX_VALUE, 1); in testWrappedDoubleuffer_IllegalArg() 71 DoubleBuffer.wrap(array, 1, Integer.MAX_VALUE); in testWrappedDoubleuffer_IllegalArg() 82 DoubleBuffer buf = DoubleBuffer.wrap(array, 2, 16); in testWrappedDoubleuffer_IllegalArg()
|
D | WrappedIntBufferTest.java | 39 int array[] = new int[20]; in testWrappedIntBuffer_IllegalArg() local 41 IntBuffer.wrap(array, -1, 0); in testWrappedIntBuffer_IllegalArg() 47 IntBuffer.wrap(array, 21, 0); in testWrappedIntBuffer_IllegalArg() 53 IntBuffer.wrap(array, 0, -1); in testWrappedIntBuffer_IllegalArg() 59 IntBuffer.wrap(array, 0, 21); in testWrappedIntBuffer_IllegalArg() 65 IntBuffer.wrap(array, Integer.MAX_VALUE, 1); in testWrappedIntBuffer_IllegalArg() 71 IntBuffer.wrap(array, 1, Integer.MAX_VALUE); in testWrappedIntBuffer_IllegalArg() 82 IntBuffer buf = IntBuffer.wrap(array, 2, 16); in testWrappedIntBuffer_IllegalArg()
|
D | WrappedFloatBufferTest.java | 39 float array[] = new float[20]; in testWrappedFloatBuffer_IllegalArg() local 41 FloatBuffer.wrap(array, -1, 0); in testWrappedFloatBuffer_IllegalArg() 47 FloatBuffer.wrap(array, 21, 0); in testWrappedFloatBuffer_IllegalArg() 53 FloatBuffer.wrap(array, 0, -1); in testWrappedFloatBuffer_IllegalArg() 59 FloatBuffer.wrap(array, 0, 21); in testWrappedFloatBuffer_IllegalArg() 65 FloatBuffer.wrap(array, Integer.MAX_VALUE, 1); in testWrappedFloatBuffer_IllegalArg() 71 FloatBuffer.wrap(array, 1, Integer.MAX_VALUE); in testWrappedFloatBuffer_IllegalArg() 82 FloatBuffer buf = FloatBuffer.wrap(array, 2, 16); in testWrappedFloatBuffer_IllegalArg()
|
D | WrappedShortBufferTest.java | 39 short array[] = new short[20]; in testWrappedShortBuffer_IllegalArg() local 41 ShortBuffer.wrap(array, -1, 0); in testWrappedShortBuffer_IllegalArg() 47 ShortBuffer.wrap(array, 21, 0); in testWrappedShortBuffer_IllegalArg() 53 ShortBuffer.wrap(array, 0, -1); in testWrappedShortBuffer_IllegalArg() 59 ShortBuffer.wrap(array, 0, 21); in testWrappedShortBuffer_IllegalArg() 65 ShortBuffer.wrap(array, Integer.MAX_VALUE, 1); in testWrappedShortBuffer_IllegalArg() 71 ShortBuffer.wrap(array, 1, Integer.MAX_VALUE); in testWrappedShortBuffer_IllegalArg() 82 ShortBuffer buf = ShortBuffer.wrap(array, 2, 16); in testWrappedShortBuffer_IllegalArg()
|
/libcore/luni/src/test/java/dalvik/system/ |
D | VMRuntimeTest.java | 30 Object array = VMRuntime.getRuntime().newNonMovableArray(componentType, -1); in doTestNewNonMovableArray() local 36 … Object array = VMRuntime.getRuntime().newNonMovableArray(componentType, Integer.MIN_VALUE); in doTestNewNonMovableArray() local 43 Object array = VMRuntime.getRuntime().newNonMovableArray(componentType, i); in doTestNewNonMovableArray() local 44 assertTrue(array.getClass().isArray()); in doTestNewNonMovableArray() 45 assertEquals(array.getClass().getComponentType(), componentType); in doTestNewNonMovableArray() 46 assertEquals(Array.getLength(array), i); in doTestNewNonMovableArray() 53 Object array = VMRuntime.getRuntime().newNonMovableArray(null, 0); in testNewNonMovableArray() local 60 Object array = VMRuntime.getRuntime().newNonMovableArray(void.class, 0); in testNewNonMovableArray() local 84 Object array = VMRuntime.getRuntime().newUnpaddedArray(componentType, -1); in doTestNewUnpaddedArray() local 90 … Object array = VMRuntime.getRuntime().newUnpaddedArray(componentType, Integer.MIN_VALUE); in doTestNewUnpaddedArray() local [all …]
|
/libcore/luni/src/test/java/libcore/java/lang/reflect/ |
D | OldAndroidArrayTest.java | 30 int[] array = (int[]) intArray; in testSingleInt() local 31 array[0] = 5; in testSingleInt() 35 assertEquals(6, array[1]); in testSingleInt() 38 array[2] = 27; in testSingleInt() 44 assertEquals(2, array.length); in testSingleInt() 45 assertEquals(Array.getLength(intArray), array.length); in testSingleInt() 61 String[] array = (String[]) strArray; in testSingle() local 62 array[0] = "entry zero"; in testSingle() 68 assertEquals("entry one", array[1]); in testSingle() 70 assertEquals(2, array.length); in testSingle() [all …]
|
/libcore/ojluni/src/test/java/util/stream/test/org/openjdk/tests/java/util/stream/ |
D | DoublePrimitiveOpsTests.java | 47 double[] array = LongStream.range(1, 10).asDoubleStream().map(i -> i * 2).toArray(); in testToArray() local 48 assertEquals(array, new double[]{2, 4, 6, 8, 10, 12, 14, 16, 18}); in testToArray() 52 … double[] array = LongStream.range(1, 10).parallel().asDoubleStream().map(i -> i * 2).toArray(); in testToArray() local 53 assertEquals(array, new double[]{2, 4, 6, 8, 10, 12, 14, 16, 18}); in testToArray() 65 double[] array = Arrays.stream(content).sorted().toArray(); in testSort() local 66 assertEquals(array, sortedContent); in testSort() 70 double[] array = Arrays.stream(content).parallel().sorted().toArray(); in testSort() local 71 assertEquals(array, sortedContent); in testSort() 83 double[] array = Arrays.stream(content).sorted().sorted().toArray(); in testSortSort() local 84 assertEquals(array, sortedContent); in testSortSort() [all …]
|