Home
last modified time | relevance | path

Searched refs:sparseArray (Results 1 – 25 of 158) sorted by relevance

1234567

/aosp_15_r20/cts/tests/tests/util/src/android/util/cts/
H A DLongSparseArrayTest.java46 LongSparseArray<Integer> sparseArray = new LongSparseArray<>(); in testSparseArrayWithDefaultCapacity() local
47 assertEquals(0, sparseArray.size()); in testSparseArrayWithDefaultCapacity()
52 sparseArray.put(KEYS[i], VALUES[i]); in testSparseArrayWithDefaultCapacity()
53 assertEquals(i + 1, sparseArray.size()); in testSparseArrayWithDefaultCapacity()
57 assertEquals(new Integer(i), sparseArray.get(KEYS[i])); in testSparseArrayWithDefaultCapacity()
61 assertEquals(sparseArray.indexOfValue(VALUES[i]), sparseArray.indexOfKey(KEYS[i])); in testSparseArrayWithDefaultCapacity()
68 assertEquals(oldValue, sparseArray.get(existKey)); in testSparseArrayWithDefaultCapacity()
69 assertEquals(LENGTH, sparseArray.size()); in testSparseArrayWithDefaultCapacity()
70 sparseArray.put(existKey, newValue); in testSparseArrayWithDefaultCapacity()
71 assertEquals(newValue, sparseArray.get(existKey)); in testSparseArrayWithDefaultCapacity()
[all …]
H A DSparseLongArrayTest.java44 SparseLongArray sparseArray = new SparseLongArray(); in testSparseArrayWithDefaultCapacity() local
45 assertEquals(0, sparseArray.size()); in testSparseArrayWithDefaultCapacity()
50 sparseArray.put(KEYS[i], VALUES[i]); in testSparseArrayWithDefaultCapacity()
51 assertEquals(i + 1, sparseArray.size()); in testSparseArrayWithDefaultCapacity()
55 assertEquals(i, sparseArray.get(KEYS[i])); in testSparseArrayWithDefaultCapacity()
59 assertEquals(sparseArray.indexOfValue(VALUES[i]), sparseArray.indexOfKey(KEYS[i])); in testSparseArrayWithDefaultCapacity()
66 assertEquals(oldValue, sparseArray.get(existKey)); in testSparseArrayWithDefaultCapacity()
67 assertEquals(LENGTH, sparseArray.size()); in testSparseArrayWithDefaultCapacity()
68 sparseArray.put(existKey, newValue); in testSparseArrayWithDefaultCapacity()
69 assertEquals(newValue, sparseArray.get(existKey)); in testSparseArrayWithDefaultCapacity()
[all …]
H A DSparseArrayTest.java50 SparseArray<Integer> sparseArray = new SparseArray<>(); in testSparseArrayWithDefaultCapacity() local
51 assertEquals(0, sparseArray.size()); in testSparseArrayWithDefaultCapacity()
56 sparseArray.put(KEYS[i], VALUES[i]); in testSparseArrayWithDefaultCapacity()
57 assertEquals(i + 1, sparseArray.size()); in testSparseArrayWithDefaultCapacity()
61 assertEquals(new Integer(i), sparseArray.get(KEYS[i])); in testSparseArrayWithDefaultCapacity()
65 assertEquals(sparseArray.indexOfValue(VALUES[i]), sparseArray.indexOfKey(KEYS[i])); in testSparseArrayWithDefaultCapacity()
72 assertEquals(oldValue, sparseArray.get(existKey)); in testSparseArrayWithDefaultCapacity()
73 assertEquals(LENGTH, sparseArray.size()); in testSparseArrayWithDefaultCapacity()
74 sparseArray.put(existKey, newValue); in testSparseArrayWithDefaultCapacity()
75 assertEquals(newValue, sparseArray.get(existKey)); in testSparseArrayWithDefaultCapacity()
[all …]
H A DSparseBooleanArrayTest.java155 SparseBooleanArray sparseArray = new SparseBooleanArray(); in testIterationOrder() local
157 sparseArray.put(1, true); in testIterationOrder()
158 sparseArray.put(10, false); in testIterationOrder()
159 sparseArray.put(5, true); in testIterationOrder()
160 sparseArray.put(Integer.MAX_VALUE, false); in testIterationOrder()
162 assertEquals(1, sparseArray.keyAt(0)); in testIterationOrder()
163 assertEquals(5, sparseArray.keyAt(1)); in testIterationOrder()
164 assertEquals(10, sparseArray.keyAt(2)); in testIterationOrder()
165 assertEquals(Integer.MAX_VALUE, sparseArray.keyAt(3)); in testIterationOrder()
167 assertEquals(true, sparseArray.valueAt(0)); in testIterationOrder()
[all …]
H A DSparseIntArrayTest.java181 SparseIntArray sparseArray = new SparseIntArray(); in testIterationOrder() local
183 sparseArray.put(1, 2); in testIterationOrder()
184 sparseArray.put(10, 20); in testIterationOrder()
185 sparseArray.put(5, 40); in testIterationOrder()
186 sparseArray.put(Integer.MAX_VALUE, Integer.MIN_VALUE); in testIterationOrder()
188 assertEquals(1, sparseArray.keyAt(0)); in testIterationOrder()
189 assertEquals(5, sparseArray.keyAt(1)); in testIterationOrder()
190 assertEquals(10, sparseArray.keyAt(2)); in testIterationOrder()
191 assertEquals(Integer.MAX_VALUE, sparseArray.keyAt(3)); in testIterationOrder()
193 assertEquals(2, sparseArray.valueAt(0)); in testIterationOrder()
[all …]
/aosp_15_r20/packages/apps/TV/tests/robotests/src/com/android/tv/util/
DMultiLongSparseArrayTest.java34 MultiLongSparseArray<String> sparseArray = new MultiLongSparseArray<>(); in testEmpty() local
35 assertThat(sparseArray.get(0)).isEmpty(); in testEmpty()
40 MultiLongSparseArray<String> sparseArray = new MultiLongSparseArray<>(); in testOneElement() local
41 sparseArray.put(0, "foo"); in testOneElement()
42 assertThat(sparseArray.get(0)).containsExactly("foo"); in testOneElement()
47 MultiLongSparseArray<String> sparseArray = new MultiLongSparseArray<>(); in testTwoElements() local
48 sparseArray.put(0, "foo"); in testTwoElements()
49 sparseArray.put(0, "bar"); in testTwoElements()
50 assertThat(sparseArray.get(0)).containsExactly("foo", "bar"); in testTwoElements()
55 MultiLongSparseArray<String> sparseArray = new MultiLongSparseArray<>(); in testClearEmptyCache() local
[all …]
/aosp_15_r20/frameworks/base/packages/SystemUI/src/com/android/systemui/util/
H A DSparseArrayUtils.kt27 val sparseArray = when { in <lambda>() constant
32 sparseArray.put(i, v) in <lambda>()
34 return sparseArray in <lambda>()
47 val sparseArray = SparseArray<T>(size) in associateByToSparseArray() constant
49 sparseArray.put(keySelector(value), value) in associateByToSparseArray()
51 return sparseArray in associateByToSparseArray()
62 val sparseArray = when { in foldToSparseArray() constant
68 val acc = sparseArray.get(key) ?: initial in foldToSparseArray()
69 sparseArray.put(key, operation(acc, elem)) in foldToSparseArray()
71 return sparseArray in foldToSparseArray()
[all …]
/aosp_15_r20/external/robolectric/integration_tests/sparsearray/src/test/java/org/robolectric/integrationtests/sparsearray/
H A DSparseArraySetTest.kt15 val sparseArray = SparseArray<String>() constant in org.robolectric.integrationtests.sparsearray.SparseArraySetTest
20 sparseArray[0] = "Blizzard" in testSparseArrayBracketOperator_callsSetMethodPreApi31()
21 sparseArray[1] = "Blizzara" in testSparseArrayBracketOperator_callsSetMethodPreApi31()
23 assertThat(sparseArray[0]).isEqualTo("Blizzard") in testSparseArrayBracketOperator_callsSetMethodPreApi31()
24 assertThat(sparseArray[1]).isEqualTo("Blizzara") in testSparseArrayBracketOperator_callsSetMethodPreApi31()
29 sparseArray.set(0, "Blizzaga") in testSparseArraySetFunction_callsSetMethodPreApi31()
30 sparseArray.set(1, "Blizzaja") in testSparseArraySetFunction_callsSetMethodPreApi31()
32 assertThat(sparseArray[0]).isEqualTo("Blizzaga") in testSparseArraySetFunction_callsSetMethodPreApi31()
33 assertThat(sparseArray[1]).isEqualTo("Blizzaja") in testSparseArraySetFunction_callsSetMethodPreApi31()
/aosp_15_r20/frameworks/base/services/tests/mockingservicestests/src/com/android/server/backup/utils/
H A DSparseArrayUtilsTest.java40 SparseArray<HashSet<String>> sparseArray = new SparseArray<>(); in union_mergesSets() local
41 sparseArray.append(12, Sets.newHashSet("a", "b", "c")); in union_mergesSets()
42 sparseArray.append(45, Sets.newHashSet("d", "e")); in union_mergesSets()
43 sparseArray.append(46, Sets.newHashSet()); in union_mergesSets()
44 sparseArray.append(66, Sets.newHashSet("a", "e", "f")); in union_mergesSets()
46 assertThat(SparseArrayUtils.union(sparseArray)).isEqualTo( in union_mergesSets()
52 SparseArray<HashSet<String>> sparseArray = new SparseArray<>(); in union_returnsEmptySetForEmptyList() local
54 assertThat(SparseArrayUtils.union(sparseArray)).isEqualTo(Sets.newHashSet()); in union_returnsEmptySetForEmptyList()
/aosp_15_r20/frameworks/base/core/tests/coretests/src/android/util/
H A DLongSparseArrayTest.java36 final LongSparseArray<Integer> sparseArray = new LongSparseArray(); in testRemoveIf() local
39 sparseArray.put(i, j); in testRemoveIf()
40 sparseArray.put(-i, j); in testRemoveIf()
41 sparseArray.put(j, -i); in testRemoveIf()
42 sparseArray.put(-j, -i); in testRemoveIf()
47 sparseArray.removeIf(predicate); in testRemoveIf()
49 for (int i = 0; i < sparseArray.size(); ++i) { in testRemoveIf()
50 assertThat(predicate.test(sparseArray.keyAt(i), sparseArray.valueAt(i))) in testRemoveIf()
/aosp_15_r20/frameworks/base/services/tests/InputMethodSystemServerTests/src/com/android/server/inputmethod/
H A DImmutableSparseArrayTest.java256 private void verifyCommonBehaviors(@NonNull ImmutableSparseArray<Object> sparseArray) { in verifyCommonBehaviors() argument
257 verifyInvalidKeyBehaviors(sparseArray); in verifyCommonBehaviors()
258 verifyOutOfBoundsBehaviors(sparseArray); in verifyCommonBehaviors()
261 private void verifyInvalidKeyBehaviors(@NonNull ImmutableSparseArray<Object> sparseArray) { in verifyInvalidKeyBehaviors() argument
263 assertThat(sparseArray.get(invalid_key)).isNull(); in verifyInvalidKeyBehaviors()
264 assertThat(sparseArray.indexOfKey(invalid_key)).isEqualTo(-1); in verifyInvalidKeyBehaviors()
267 private void verifyOutOfBoundsBehaviors(@NonNull ImmutableSparseArray<Object> sparseArray) { in verifyOutOfBoundsBehaviors() argument
268 final int size = sparseArray.size(); in verifyOutOfBoundsBehaviors()
270 () -> sparseArray.keyAt(size)); in verifyOutOfBoundsBehaviors()
272 () -> sparseArray.valueAt(size)); in verifyOutOfBoundsBehaviors()
[all …]
/aosp_15_r20/packages/modules/AppSearch/testing/safeparceltests/src/android/app/appsearch/safeparcel/
DSafeParcelableSparseArrayTest.java50 SparseArray<Bundle> sparseArray = new SparseArray<>(keys.length); in newBundleSparseArray() local
52 sparseArray.put(keys[i], newTestBundle(keys[i])); in newBundleSparseArray()
54 return sparseArray; in newBundleSparseArray()
60 SparseArray<byte[]> sparseArray = new SparseArray<>(); in testReadWriteBytesSparseArray() local
61 sparseArray.append(20, new byte[] {1}); in testReadWriteBytesSparseArray()
62 sparseArray.append(200, new byte[] {2}); in testReadWriteBytesSparseArray()
65 mParcel, TEST_ID, sparseArray, /* writeNull= */ false); in testReadWriteBytesSparseArray()
71 assertByteArrayEquals(sparseArray, readSparseArray); in testReadWriteBytesSparseArray()
78 SparseArray<Bundle> sparseArray = newBundleSparseArray(keys); in testReadWriteBundleSparseArray() local
81 mParcel, TEST_ID, sparseArray, /* writeNull= */ false); in testReadWriteBundleSparseArray()
[all …]
/aosp_15_r20/prebuilts/go/linux-x86/src/archive/tar/
Dformat.go167 func (b *block) toSparse() sparseArray { return sparseArray(b[:]) }
270 func (h *headerGNU) sparse() sparseArray { return sparseArray(h[386:][:24*4+1]) }
298 type sparseArray []byte type
300 func (s sparseArray) entry(i int) sparseElem { return sparseElem(s[i*24:]) }
301 func (s sparseArray) isExtended() []byte { return s[24*s.maxEntries():][:1] }
302 func (s sparseArray) maxEntries() int { return len(s) / 24 }
/aosp_15_r20/packages/modules/Connectivity/staticlibs/tests/unit/src/com/android/net/module/util/
DCollectionUtilsTest.kt186 val sparseArray = SparseArray<String>() in testGetIndexForValue() constant
187 sparseArray.put(5, "hello") in testGetIndexForValue()
188 sparseArray.put(10, "abcd") in testGetIndexForValue()
189 sparseArray.put(20, null) in testGetIndexForValue()
195 assertEquals(1, CollectionUtils.getIndexForValue(sparseArray, value1)) in testGetIndexForValue()
196 assertEquals(1, CollectionUtils.getIndexForValue(sparseArray, value1Copy)) in testGetIndexForValue()
197 assertEquals(2, CollectionUtils.getIndexForValue(sparseArray, value2)) in testGetIndexForValue()
/aosp_15_r20/frameworks/base/core/java/android/os/vibrator/
H A DVibratorFrequencyProfile.java137 SparseArray<Float> sparseArray = new SparseArray<>(frequencies.length); in generateFrequencyToAccelerationMap() local
143 sparseArray.put(frequency, in generateFrequencyToAccelerationMap()
144 Math.min(acceleration, sparseArray.get(frequency, Float.MAX_VALUE))); in generateFrequencyToAccelerationMap()
148 return sparseArray; in generateFrequencyToAccelerationMap()
/aosp_15_r20/platform_testing/libraries/screenshot/src/main/java/platform/test/screenshot/
H A DMaterialYouColorsRule.kt93 val sparseArray = SparseIntArray(/* initialCapacity= */ expectedSize) in fromColors() constant
95 sparseArray.put(FIRST_RESOURCE_COLOR_ID + i, color) in fromColors()
98 return MaterialYouColors(sparseArray) in fromColors()
/aosp_15_r20/cts/tests/tests/os/src/android/os/cts/
H A DParcelTest.java541 SparseArray<Object> sparseArray = new SparseArray<Object>(); in testReadValue() local
542 sparseArray.put(3, "String"); in testReadValue()
543 sparseArray.put(2, Long.MAX_VALUE); in testReadValue()
544 sparseArray.put(4, Float.MAX_VALUE); in testReadValue()
545 sparseArray.put(0, Integer.MAX_VALUE); in testReadValue()
546 sparseArray.put(1, true); in testReadValue()
547 sparseArray.put(10, true); in testReadValue()
550 p.writeValue(sparseArray); in testReadValue()
554 assertEquals(sparseArray.size(), sparseArray2.size()); in testReadValue()
555 assertEquals(sparseArray.get(0), sparseArray2.get(0)); in testReadValue()
[all …]
/aosp_15_r20/packages/modules/AppSearch/testing/coretests/src/android/app/appsearch/external/util/
DBundleUtilTest.java269 SparseArray<Parcelable> sparseArray = new SparseArray<>(); in createThoroughBundle() local
270 sparseArray.put(24, toy1); in createThoroughBundle()
271 sparseArray.put(1025, toy2); in createThoroughBundle()
272 b.putSparseParcelableArray("sparceParcelableArray", sparseArray); in createThoroughBundle()
/aosp_15_r20/external/mobly-bundled-snippets/src/main/java/com/google/android/mobly/snippet/bundled/utils/
H A DJsonSerializer.java225 SparseArray<byte[]> sparseArray = record.getManufacturerSpecificData(); in serializeBleScanManufacturerSpecificData() local
226 for (int i = 0; i < sparseArray.size(); i++) { in serializeBleScanManufacturerSpecificData()
227 int key = sparseArray.keyAt(i); in serializeBleScanManufacturerSpecificData()
228 result.putByteArray(String.valueOf(key), sparseArray.get(key)); in serializeBleScanManufacturerSpecificData()
/aosp_15_r20/external/exoplayer/tree_15dc86382f17a24a3e881e52e31a810c1ea44b49/library/common/src/main/java/com/google/android/exoplayer2/util/
H A DBundleableUtil.java132 SparseArray<Bundle> sparseArray = new SparseArray<>(bundleableSparseArray.size()); in toBundleSparseArray() local
134 sparseArray.put(bundleableSparseArray.keyAt(i), bundleableSparseArray.valueAt(i).toBundle()); in toBundleSparseArray()
136 return sparseArray; in toBundleSparseArray()
/aosp_15_r20/external/exoplayer/tree_8e57d3715f9092d5ec54ebe2e538f34bfcc34479/library/common/src/main/java/com/google/android/exoplayer2/util/
H A DBundleableUtil.java132 SparseArray<Bundle> sparseArray = new SparseArray<>(bundleableSparseArray.size()); in toBundleSparseArray() local
134 sparseArray.put(bundleableSparseArray.keyAt(i), bundleableSparseArray.valueAt(i).toBundle()); in toBundleSparseArray()
136 return sparseArray; in toBundleSparseArray()
/aosp_15_r20/frameworks/base/tests/Codegen/src/com/android/codegentest/
H A DParcelAllTheThingsDataClass.java77 @NonNull SparseArray<SampleWithCustomBuilder> sparseArray, in ParcelAllTheThingsDataClass() argument
95 this.mSparseArray = sparseArray;
203 …SparseArray<SampleWithCustomBuilder> sparseArray = (SparseArray) in.readSparseArray(SampleWithCust… in ParcelAllTheThingsDataClass() local
222 this.mSparseArray = sparseArray; in ParcelAllTheThingsDataClass()
/aosp_15_r20/external/robolectric/shadows/framework/src/main/java/org/robolectric/shadows/
H A DShadowResourcesImpl.java25 for (LongSparseArray<?> sparseArray : resettableArrays) { in reset()
26 sparseArray.clear(); in reset()
/aosp_15_r20/packages/modules/Connectivity/staticlibs/framework/com/android/net/module/util/
DCollectionUtils.java403 public static <T> int getIndexForValue(SparseArray<T> sparseArray, T value) { in getIndexForValue() argument
404 for(int i = 0, nsize = sparseArray.size(); i < nsize; i++) { in getIndexForValue()
405 T valueAt = sparseArray.valueAt(i); in getIndexForValue()
/aosp_15_r20/frameworks/base/services/core/java/com/android/server/hdmi/
H A DHdmiUtils.java403 SparseArray<T> sparseArray) { in dumpSparseArray() argument
406 int size = sparseArray.size(); in dumpSparseArray()
408 int key = sparseArray.keyAt(i); in dumpSparseArray()
409 T value = sparseArray.get(key); in dumpSparseArray()

1234567