Tabnine Logo
SimpleArrayMap
Code IndexAdd Tabnine to your IDE (free)

How to use
SimpleArrayMap
in
com.lody.virtual.helper.collection

Best Java code snippets using com.lody.virtual.helper.collection.SimpleArrayMap (Showing top 20 results out of 315)

origin: android-hacker/VirtualXposed

if (key == null) {
  hash = 0;
  index = indexOfNull();
} else {
  hash = key.hashCode();
  index = indexOf(key, hash);
  allocArrays(n);
  freeArrays(ohashes, oarray, mSize);
origin: android-hacker/VirtualXposed

/**
 * Perform a {@link #put(Object, Object)} of all key/value pairs in <var>array</var>
 * @param array The array whose contents are to be retrieved.
 */
public void putAll(SimpleArrayMap<? extends K, ? extends V> array) {
  final int N = array.mSize;
  ensureCapacity(mSize + N);
  if (mSize == 0) {
    if (N > 0) {
      System.arraycopy(array.mHashes, 0, mHashes, 0, N);
      System.arraycopy(array.mArray, 0, mArray, 0, N<<1);
      mSize = N;
    }
  } else {
    for (int i=0; i<N; i++) {
      put(array.keyAt(i), array.valueAt(i));
    }
  }
}
origin: android-hacker/VirtualXposed

/**
 * Remove an existing key from the array map.
 * @param key The key of the mapping to remove.
 * @return Returns the value that was stored under the key, or null if there
 * was no such key.
 */
public V remove(Object key) {
  final int index = indexOfKey(key);
  if (index >= 0) {
    return removeAt(index);
  }
  return null;
}
origin: android-hacker/VirtualXposed

/**
 * Returns the index of a key in the set.
 *
 * @param key The key to search for.
 * @return Returns the index of the key if it exists, else a negative integer.
 */
public int indexOfKey(Object key) {
  return key == null ? indexOfNull() : indexOf(key, key.hashCode());
}
origin: android-hacker/VirtualXposed

if (isEmpty()) {
  return "{}";
    buffer.append(", ");
  Object key = keyAt(i);
  if (key != this) {
    buffer.append(key);
  Object value = valueAt(i);
  if (value != this) {
    buffer.append(value);
origin: android-hacker/VirtualXposed

if (size() != map.size()) {
  return false;
    K key = keyAt(i);
    V mine = valueAt(i);
    Object theirs = map.get(key);
    if (mine == null) {
origin: android-hacker/VirtualXposed

/**
 * Ensure the array map can hold at least <var>minimumCapacity</var>
 * items.
 */
public void ensureCapacity(int minimumCapacity) {
  if (mHashes.length < minimumCapacity) {
    final int[] ohashes = mHashes;
    final Object[] oarray = mArray;
    allocArrays(minimumCapacity);
    if (mSize > 0) {
      System.arraycopy(ohashes, 0, mHashes, 0, mSize);
      System.arraycopy(oarray, 0, mArray, 0, mSize<<1);
    }
    freeArrays(ohashes, oarray, mSize);
  }
}
origin: android-hacker/VirtualXposed

/**
 * Check whether a key exists in the array.
 *
 * @param key The key to search for.
 * @return Returns true if the key exists, else false.
 */
public boolean containsKey(Object key) {
  return indexOfKey(key) >= 0;
}
origin: android-hacker/VirtualXposed

/**
 * Make the array map empty.  All storage is released.
 */
public void clear() {
  if (mSize != 0) {
    freeArrays(mHashes, mArray, mSize);
    mHashes = ContainerHelpers.EMPTY_INTS;
    mArray = ContainerHelpers.EMPTY_OBJECTS;
    mSize = 0;
  }
}
origin: android-hacker/VirtualXposed

/**
 * Check whether a value exists in the array.  This requires a linear search
 * through the entire array.
 *
 * @param value The value to search for.
 * @return Returns true if the value exists, else false.
 */
public boolean containsValue(Object value) {
  return indexOfValue(value) >= 0;
}
origin: android-hacker/VirtualXposed

/**
 * Create a new ArrayMap with a given initial capacity.
 */
public SimpleArrayMap(int capacity) {
  if (capacity == 0) {
    mHashes = ContainerHelpers.EMPTY_INTS;
    mArray = ContainerHelpers.EMPTY_OBJECTS;
  } else {
    allocArrays(capacity);
  }
  mSize = 0;
}
origin: bzsome/VirtualApp-x326

if (isEmpty()) {
  return "{}";
    buffer.append(", ");
  Object key = keyAt(i);
  if (key != this) {
    buffer.append(key);
  Object value = valueAt(i);
  if (value != this) {
    buffer.append(value);
origin: darkskygit/VirtualApp

if (size() != map.size()) {
  return false;
    K key = keyAt(i);
    V mine = valueAt(i);
    Object theirs = map.get(key);
    if (mine == null) {
origin: android-hacker/VirtualXposed

freeArrays(mHashes, mArray, mSize);
mHashes = ContainerHelpers.EMPTY_INTS;
mArray = ContainerHelpers.EMPTY_OBJECTS;
  allocArrays(n);
origin: darkskygit/VirtualApp

/**
 * Returns the index of a key in the set.
 *
 * @param key The key to search for.
 * @return Returns the index of the key if it exists, else a negative integer.
 */
public int indexOfKey(Object key) {
  return key == null ? indexOfNull() : indexOf(key, key.hashCode());
}
origin: android-hacker/VirtualXposed

/**
 * Retrieve a value from the array.
 * @param key The key of the value to retrieve.
 * @return Returns the value associated with the given key,
 * or null if there is no such key.
 */
public V get(Object key) {
  final int index = indexOfKey(key);
  return index >= 0 ? (V)mArray[(index<<1)+1] : null;
}
origin: bzsome/VirtualApp-x326

/**
 * Make the array map empty.  All storage is released.
 */
public void clear() {
  if (mSize != 0) {
    freeArrays(mHashes, mArray, mSize);
    mHashes = ContainerHelpers.EMPTY_INTS;
    mArray = ContainerHelpers.EMPTY_OBJECTS;
    mSize = 0;
  }
}
origin: darkskygit/VirtualApp

/**
 * Check whether a value exists in the array.  This requires a linear search
 * through the entire array.
 *
 * @param value The value to search for.
 * @return Returns true if the value exists, else false.
 */
public boolean containsValue(Object value) {
  return indexOfValue(value) >= 0;
}
origin: bzsome/VirtualApp-x326

/**
 * Create a new ArrayMap with a given initial capacity.
 */
public SimpleArrayMap(int capacity) {
  if (capacity == 0) {
    mHashes = ContainerHelpers.EMPTY_INTS;
    mArray = ContainerHelpers.EMPTY_OBJECTS;
  } else {
    allocArrays(capacity);
  }
  mSize = 0;
}
origin: darkskygit/VirtualApp

/**
 * Perform a {@link #put(Object, Object)} of all key/value pairs in <var>array</var>
 * @param array The array whose contents are to be retrieved.
 */
public void putAll(SimpleArrayMap<? extends K, ? extends V> array) {
  final int N = array.mSize;
  ensureCapacity(mSize + N);
  if (mSize == 0) {
    if (N > 0) {
      System.arraycopy(array.mHashes, 0, mHashes, 0, N);
      System.arraycopy(array.mArray, 0, mArray, 0, N<<1);
      mSize = N;
    }
  } else {
    for (int i=0; i<N; i++) {
      put(array.keyAt(i), array.valueAt(i));
    }
  }
}
com.lody.virtual.helper.collectionSimpleArrayMap

Javadoc

Base implementation of ArrayMap that doesn't include any standard Java container API interoperability. These features are generally heavier-weight ways to interact with the container, so discouraged, but they can be useful to make it easier to use as a drop-in replacement for HashMap. If you don't need them, this class can be preferrable since it doesn't bring in any of the implementation of those APIs, allowing that code to be stripped by ProGuard.

Most used methods

  • allocArrays
  • ensureCapacity
    Ensure the array map can hold at least minimumCapacity items.
  • freeArrays
  • indexOf
  • indexOfKey
    Returns the index of a key in the set.
  • indexOfNull
  • indexOfValue
  • isEmpty
    Return true if the array map contains no items.
  • keyAt
    Return the key at the given index in the array.
  • put
    Add a new value to the array map.
  • putAll
    Perform a #put(Object,Object) of all key/value pairs in array
  • removeAt
    Remove the key/value mapping at the given index.
  • putAll,
  • removeAt,
  • size,
  • valueAt

Popular in Java

  • Making http post requests using okhttp
  • getResourceAsStream (ClassLoader)
  • findViewById (Activity)
  • onRequestPermissionsResult (Fragment)
  • PrintWriter (java.io)
    Wraps either an existing OutputStream or an existing Writerand provides convenience methods for prin
  • MalformedURLException (java.net)
    This exception is thrown when a program attempts to create an URL from an incorrect specification.
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Iterator (java.util)
    An iterator over a sequence of objects, such as a collection.If a collection has been changed since
  • Timer (java.util)
    Timers schedule one-shot or recurring TimerTask for execution. Prefer java.util.concurrent.Scheduled
  • JList (javax.swing)
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now