LongSparseArray implements Cloneable { @Nullable @SuppressWarnings("NullAway") public E get(long key) { return get(key, null); } LongSparseArray();  LongSparseArray(int initialCapacity); @Override @SuppressWarnings("unchecked") LongSparseArray<E> clone(); @Nullable @SuppressWarnings("NullAway") // See inline comment. E get(long key); @SuppressWarnings("unchecked") E get(long key, E valueIfKeyNotFound); @Deprecated void delete(long key); void remove(long key); boolean remove(long key, Object value); void removeAt(int index); @Nullable E replace(long key, E value); boolean replace(long key, E oldValue, E newValue); void put(long key, E value); void putAll(@NonNull LongSparseArray<? extends E> other); @Nullable E putIfAbsent(long key, E value); int size(); boolean isEmpty(); long keyAt(int index); @SuppressWarnings("unchecked") E valueAt(int index); void setValueAt(int index, E value); int indexOfKey(long key); int indexOfValue(E value); boolean containsKey(long key); boolean containsValue(E value); void clear(); void append(long key, E value); @Override String toString();  }
@Test public void getOrDefaultUsesDefaultWhenAbsent() { LongSparseArray<String> map = new LongSparseArray<>(); assertEquals("1", map.get(1L, "1")); }