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

How to use
Byte2ObjectOpenHashMap
in
it.unimi.dsi.fastutil.bytes

Best Java code snippets using it.unimi.dsi.fastutil.bytes.Byte2ObjectOpenHashMap (Showing top 20 results out of 315)

origin: GoMint/GoMint

/**
 * Constructs a new, empty metadata container which may pre-allocate
 * enough internal capacities to hold at least capacity entries.
 *
 * @param capacity The capacity to pre-allocate
 */
public MetadataContainer( int capacity ) {
  this.entries = new Byte2ObjectOpenHashMap<>( ( capacity > 32 ? 32 : capacity ) );
}
origin: it.unimi.dsi/fastutil

@Override
public void clear() {
  Byte2ObjectOpenHashMap.this.clear();
}
/** {@inheritDoc} */
origin: it.unimi.dsi/fastutil

@Override
public boolean contains(Object v) {
  return containsValue(v);
}
@Override
origin: it.unimi.dsi/fastutil

@Override
public V put(final byte k, final V v) {
  final int pos = find(k);
  if (pos < 0) {
    insert(-pos - 1, k, v);
    return defRetValue;
  }
  final V oldValue = value[pos];
  value[pos] = v;
  return oldValue;
}
/**
origin: it.unimi.dsi/fastutil

@Override
public void putAll(Map<? extends Byte, ? extends V> m) {
  if (f <= .5)
    ensureCapacity(m.size()); // The resulting map will be sized for m.size() elements
  else
    tryCapacity(size() + m.size()); // The resulting map will be tentatively sized for size() + m.size()
                    // elements
  super.putAll(m);
}
origin: it.unimi.dsi/fastutil

/** {@inheritDoc} */
@Override
public V merge(final byte k, final V v,
    final java.util.function.BiFunction<? super V, ? super V, ? extends V> remappingFunction) {
  java.util.Objects.requireNonNull(remappingFunction);
  final int pos = find(k);
  if (pos < 0 || value[pos] == null) {
    if (v == null)
      return defRetValue;
    insert(-pos - 1, k, v);
    return v;
  }
  final V newValue = remappingFunction.apply((value[pos]), (v));
  if (newValue == null) {
    if (((k) == ((byte) 0)))
      removeNullEntry();
    else
      removeEntry(pos);
    return defRetValue;
  }
  return value[pos] = (newValue);
}
/*
origin: it.unimi.dsi/fastutil

/** {@inheritDoc} */
@Override
public V computeIfPresent(final byte k,
    final java.util.function.BiFunction<? super Byte, ? super V, ? extends V> remappingFunction) {
  java.util.Objects.requireNonNull(remappingFunction);
  final int pos = find(k);
  if (pos < 0)
    return defRetValue;
  final V newValue = remappingFunction.apply(Byte.valueOf(k), (value[pos]));
  if (newValue == null) {
    if (((k) == ((byte) 0)))
      removeNullEntry();
    else
      removeEntry(pos);
    return defRetValue;
  }
  return value[pos] = (newValue);
}
/** {@inheritDoc} */
origin: dmart28/reveno

public void put(byte[] key, T value) {
  Node n = root;
  for (int i = 0; i < key.length; i++) {
    Node nn = n.map.get(key[i]);
    if (nn == null) {
      nn = new Node();
      n.map.put(key[i], nn);
    }
    n = nn;
    if (i == key.length - 1) {
      n.value = value;
    }
  }
}
origin: it.unimi.dsi/fastutil

/**
 * Creates a new hash map using the elements of two parallel arrays.
 *
 * @param k
 *            the array of keys of the new hash map.
 * @param v
 *            the array of corresponding values in the new hash map.
 * @param f
 *            the load factor.
 * @throws IllegalArgumentException
 *             if {@code k} and {@code v} have different lengths.
 */
public Byte2ObjectOpenHashMap(final byte[] k, final V[] v, final float f) {
  this(k.length, f);
  if (k.length != v.length)
    throw new IllegalArgumentException(
        "The key array and the value array have different lengths (" + k.length + " and " + v.length + ")");
  for (int i = 0; i < k.length; i++)
    this.put(k[i], v[i]);
}
/**
origin: it.unimi.dsi/fastutil

/** {@inheritDoc} */
@Override
public V replace(final byte k, final V v) {
  final int pos = find(k);
  if (pos < 0)
    return defRetValue;
  final V oldValue = value[pos];
  value[pos] = v;
  return oldValue;
}
/** {@inheritDoc} */
origin: it.unimi.dsi/fastutil

/**
 * Creates a new hash map copying a given one.
 *
 * @param m
 *            a {@link Map} to be copied into the new hash map.
 * @param f
 *            the load factor.
 */
public Byte2ObjectOpenHashMap(final Map<? extends Byte, ? extends V> m, final float f) {
  this(m.size(), f);
  putAll(m);
}
/**
origin: dmart28/reveno

public T get(byte[] key) {
  Node n = root;
  for (int i = 0; i < key.length; i++) {
    if ((n = n.map.get(key[i])) == null) {
      return null;
    }
  }
  return n.value;
}
origin: org.gephi/graphstore

  serialize(out, map.values().toArray());
} else if (oCls.equals(Byte2ObjectOpenHashMap.class)) {
  serialize(out, ((Byte2ObjectOpenHashMap) map).keySet().toByteArray());
  serialize(out, map.values().toArray());
} else if (oCls.equals(Char2ObjectOpenHashMap.class)) {
origin: it.unimi.dsi/fastutil

/** {@inheritDoc} */
@Override
public V compute(final byte k,
    final java.util.function.BiFunction<? super Byte, ? super V, ? extends V> remappingFunction) {
  java.util.Objects.requireNonNull(remappingFunction);
  final int pos = find(k);
  final V newValue = remappingFunction.apply(Byte.valueOf(k), pos >= 0 ? (value[pos]) : null);
  if (newValue == null) {
    if (pos >= 0) {
      if (((k) == ((byte) 0)))
        removeNullEntry();
      else
        removeEntry(pos);
    }
    return defRetValue;
  }
  V newVal = (newValue);
  if (pos < 0) {
    insert(-pos - 1, k, newVal);
    return newVal;
  }
  return value[pos] = newVal;
}
/** {@inheritDoc} */
origin: it.unimi.dsi/fastutil

/** {@inheritDoc} */
@Override
public V putIfAbsent(final byte k, final V v) {
  final int pos = find(k);
  if (pos >= 0)
    return value[pos];
  insert(-pos - 1, k, v);
  return defRetValue;
}
/** {@inheritDoc} */
origin: it.unimi.dsi/fastutil

/** {@inheritDoc} */
@Override
public boolean replace(final byte k, final V oldValue, final V v) {
  final int pos = find(k);
  if (pos < 0 || !java.util.Objects.equals(oldValue, value[pos]))
    return false;
  value[pos] = v;
  return true;
}
/** {@inheritDoc} */
origin: it.unimi.dsi/fastutil

/**
 * Creates a new hash map copying a given type-specific one.
 *
 * @param m
 *            a type-specific map to be copied into the new hash map.
 * @param f
 *            the load factor.
 */
public Byte2ObjectOpenHashMap(final Byte2ObjectMap<V> m, final float f) {
  this(m.size(), f);
  putAll(m);
}
/**
origin: dmart28/reveno

public T get(Buffer buffer, int count) {
  Node n = root;
  for (int i = 0; i < count; i++) {
    if ((n = n.map.get(buffer.readByte())) == null) {
      return null;
    }
  }
  return n.value;
}
origin: gephi/graphstore

  serialize(out, map.values().toArray());
} else if (oCls.equals(Byte2ObjectOpenHashMap.class)) {
  serialize(out, ((Byte2ObjectOpenHashMap) map).keySet().toByteArray());
  serialize(out, map.values().toArray());
} else if (oCls.equals(Char2ObjectOpenHashMap.class)) {
origin: gephi/graphstore

  return new Short2ObjectOpenHashMap(map);
} else if (oCls.equals(Byte.class)) {
  return new Byte2ObjectOpenHashMap(map);
} else if (oCls.equals(Long.class)) {
  return new Long2ObjectOpenHashMap(map);
it.unimi.dsi.fastutil.bytesByte2ObjectOpenHashMap

Javadoc

A type-specific hash map with a fast, small-footprint implementation.

Instances of this class use a hash table to represent a map. The table is filled up to a specified load factor, and then doubled in size to accommodate new entries. If the table is emptied below one fourth of the load factor, it is halved in size; however, the table is never reduced to a size smaller than that at creation time: this approach makes it possible to create maps with a large capacity in which insertions and deletions do not cause immediately rehashing. Moreover, halving is not performed when deleting entries from an iterator, as it would interfere with the iteration process.

Note that #clear() does not modify the hash table size. Rather, a family of #trim() lets you control the size of the table; this is particularly useful if you reuse instances of this class.

Most used methods

  • <init>
    Creates a new hash map using the elements of two parallel arrays.
  • put
  • clear
  • containsValue
  • ensureCapacity
  • find
  • get
  • insert
  • keySet
  • putAll
  • realSize
  • rehash
    Rehashes the map. This method implements the basic rehashing strategy, and may be overridden by subc
  • realSize,
  • rehash,
  • removeEntry,
  • removeNullEntry,
  • shiftKeys,
  • size,
  • tryCapacity

Popular in Java

  • Reading from database using SQL prepared statement
  • onRequestPermissionsResult (Fragment)
  • getSupportFragmentManager (FragmentActivity)
  • setScale (BigDecimal)
  • Kernel (java.awt.image)
  • SQLException (java.sql)
    An exception that indicates a failed JDBC operation. It provides the following information about pro
  • Dictionary (java.util)
    Note: Do not use this class since it is obsolete. Please use the Map interface for new implementatio
  • HttpServletRequest (javax.servlet.http)
    Extends the javax.servlet.ServletRequest interface to provide request information for HTTP servlets.
  • Scheduler (org.quartz)
    This is the main interface of a Quartz Scheduler. A Scheduler maintains a registry of org.quartz.Job
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top PhpStorm plugins
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