本文整理汇总了Java中android.util.SparseLongArray.append方法的典型用法代码示例。如果您正苦于以下问题:Java SparseLongArray.append方法的具体用法?Java SparseLongArray.append怎么用?Java SparseLongArray.append使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.util.SparseLongArray
的用法示例。
在下文中一共展示了SparseLongArray.append方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEquals
import android.util.SparseLongArray; //导入方法依赖的package包/类
public void testEquals() {
if (VERSION.SDK_INT < VERSION_CODES.JELLY_BEAN_MR2) {
return;
}
final SparseLongArray array = new SparseLongArray();
for (int i = 0; i < 5; i++) {
array.append(i, i);
}
assertThat(SparseCollections.iterate(mArray)
.isStrictlyEqualTo(SparseCollections.iterate(array))).isTrue();
assertThat(SparseCollections.iterate(array)
.isStrictlyEqualTo(SparseCollections.iterate(mArray))).isTrue();
assertThat(SparseCollections.iterate(array)
.only()
.key(2)
.remove()
.isStrictlyEqualTo(
SparseCollections.iterate(mArray))).isFalse();
assertThat(SparseCollections.iterate(mArray)
.isStrictlyEqualTo(SparseCollections.iterate(array))).isFalse();
final SparseLongArray sparseArray = SparseCollections.iterate(mArray).toSparseArray();
assertThat(SparseCollections.iterate(mArray).isEqualTo(mArray)).isTrue();
assertThat(SparseCollections.iterate(mArray).only().first(2).isEqualTo(mArray)).isFalse();
assertThat(SparseCollections.iterate(mArray).isEqualTo(sparseArray)).isTrue();
assertThat(
SparseCollections.iterate(mArray).only().first(2).isEqualTo(sparseArray)).isFalse();
final ArrayList<IntSparseLongEntry> list =
SparseCollections.iterate(mArray).toImmutableList();
assertThat(SparseCollections.iterate(mArray).isEqualTo(list)).isTrue();
assertThat(SparseCollections.iterate(mArray).only().first(2).isEqualTo(list)).isFalse();
final ArrayList<ParcelableIntSparseLongEntry> parcelableList =
SparseCollections.iterate(mArray).toParcelableList();
assertThat(SparseCollections.iterate(mArray).isEqualTo(parcelableList)).isTrue();
assertThat(SparseCollections.iterate(mArray)
.only()
.first(2)
.isEqualTo(parcelableList)).isFalse();
final Map<Integer, Long> map = SparseCollections.iterate(mArray).toMap();
assertThat(SparseCollections.iterate(mArray).isEqualTo(map)).isTrue();
assertThat(SparseCollections.iterate(mArray).only().first(2).isEqualTo(map)).isFalse();
final SortedMap<Integer, Long> sortedMap = SparseCollections.iterate(mArray).toSortedMap();
assertThat(SparseCollections.iterate(mArray).isEqualTo(sortedMap)).isTrue();
assertThat(
SparseCollections.iterate(mArray).only().first(2).isEqualTo(sortedMap)).isFalse();
mArray.append(7, 7L);
assertThat(SparseCollections.iterate(mArray).isEqualTo(sparseArray)).isFalse();
assertThat(SparseCollections.iterate(mArray).but().last(1).isEqualTo(sparseArray)).isTrue();
assertThat(SparseCollections.iterate(mArray).isEqualTo(list)).isFalse();
assertThat(SparseCollections.iterate(mArray).but().last(1).isEqualTo(list)).isTrue();
assertThat(SparseCollections.iterate(mArray).isEqualTo(parcelableList)).isFalse();
assertThat(
SparseCollections.iterate(mArray).but().last(1).isEqualTo(parcelableList)).isTrue();
assertThat(SparseCollections.iterate(mArray).isEqualTo(map)).isFalse();
assertThat(SparseCollections.iterate(mArray).but().last(1).isEqualTo(map)).isTrue();
assertThat(SparseCollections.iterate(mArray).isEqualTo(sortedMap)).isFalse();
assertThat(SparseCollections.iterate(mArray).but().last(1).isEqualTo(sortedMap)).isTrue();
}
示例2: setUp
import android.util.SparseLongArray; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
if (VERSION.SDK_INT < VERSION_CODES.JELLY_BEAN_MR2) {
return;
}
final SparseLongArray array = new SparseLongArray();
for (int i = 0; i < 5; i++) {
array.append(i, i);
}
mArray = array;
}
示例3: appendTo
import android.util.SparseLongArray; //导入方法依赖的package包/类
@Override
public SparseLongArrayIterable appendTo(final SparseLongArray other) {
for (final SparseLongArrayEntry entry : this) {
other.append(entry.getKey(), entry.getValue());
}
return this;
}
示例4: replaceValues
import android.util.SparseLongArray; //导入方法依赖的package包/类
@Override
public SparseLongArrayIterable replaceValues(final LongTranslator translator) {
final SparseLongArray array = mArray;
for (final SparseLongArrayEntry entry : this) {
array.append(entry.getKey(), translator.translate(entry.getValue()));
}
return this;
}
示例5: toSparseArray
import android.util.SparseLongArray; //导入方法依赖的package包/类
@Override
public SparseLongArray toSparseArray() {
final SparseLongArray array = new SparseLongArray();
for (final SparseLongArrayEntry entry : this) {
array.append(entry.getKey(), entry.getValue());
}
return array;
}