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

How to use
LongLinkedOpenHashSet
in
it.unimi.dsi.fastutil.longs

Best Java code snippets using it.unimi.dsi.fastutil.longs.LongLinkedOpenHashSet (Showing top 13 results out of 315)

origin: com.senseidb/sensei-core

public synchronized void add(long uid) {
 if (elems.size() == capacity) {
  elems.remove(elems.firstLong());
 }
 elems.add(uid);
}
origin: com.senseidb/sensei-core

public RecentlyAddedUids(int capacity) {
 this.capacity = capacity;
 elems = new LongLinkedOpenHashSet(capacity);
}
origin: com.senseidb/sensei-core

protected synchronized void clear() {
 elems.clear();
}
origin: it.unimi.dsi/fastutil

@Override
public boolean addAll(Collection<? extends Long> c) {
  // The resulting collection will be at least c.size() big
  if (f <= .5)
    ensureCapacity(c.size()); // The resulting collection will be sized for c.size() elements
  else
    tryCapacity(size() + c.size()); // The resulting collection will be tentatively sized for size() + c.size()
                    // elements
  return super.addAll(c);
}
@Override
origin: it.unimi.di/mg4j-big

LongLinkedOpenHashSet s0 = new LongLinkedOpenHashSet();
LongLinkedOpenHashSet s1 = new LongLinkedOpenHashSet();
LongAVLTreeSet s2 = new LongAVLTreeSet();
LongBidirectionalIterator it;
        s0.clear();
        s1.clear();
        s0.retainAll( s1 );
        indexIterator =  termLists ? indexReader[ i ].documents( terms[ i ].get( t ) ) : indexReader[ i ].documents( t );
        additionalIterator = termLists ? additionalReader.documents( terms[ i ].get( u ) ) : additionalReader.documents( u );
        it = s0.iterator();
        documentIterator = AndDocumentIterator.getInstance( indexIterator, additionalIterator );
        for( int j = s0.size(); j-- != 0; ) if ( it.nextLong() != documentIterator.nextDocument() ) throw new AssertionError();
origin: it.unimi.dsi/fastutil

/**
 * Creates a new hash set and fills it with the elements of a given array.
 *
 * @param a
 *            an array whose elements will be used to fill the set.
 * @param offset
 *            the first element to use.
 * @param length
 *            the number of elements to use.
 * @param f
 *            the load factor.
 */
public LongLinkedOpenHashSet(final long[] a, final int offset, final int length, final float f) {
  this(length < 0 ? 0 : length, f);
  LongArrays.ensureOffsetLength(a, offset, length);
  for (int i = 0; i < length; i++)
    add(a[offset + i]);
}
/**
origin: it.unimi.dsi/fastutil

private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException {
  final LongIterator i = iterator();
  s.defaultWriteObject();
  for (int j = size; j-- != 0;)
    s.writeLong(i.nextLong());
}
origin: it.unimi.dsi/fastutil

/**
 * Creates a new hash set copying a given collection.
 *
 * @param c
 *            a {@link Collection} to be copied into the new hash set.
 * @param f
 *            the load factor.
 */
public LongLinkedOpenHashSet(final Collection<? extends Long> c, final float f) {
  this(c.size(), f);
  addAll(c);
}
/**
origin: mjugo/StreamingRec

@Override
protected void trainInternal(List<Item> items, List<ClickData> clickData) {
  //whenever a click occurs, remove the id of the article that has been clicked
  //from the result list and push it to the front 
  for (ClickData c : clickData) {
    clickedItems.addAndMoveToFirst(c.click.item.id);
  }
}
origin: com.senseidb/sensei-core

public synchronized int markRecentAsFoundInBitSet(long[] uids, BitSet found, int bitSetLength) {
 if (found.length() == 0) {
  return 0;
 }
 int ret = 0;
 int index = 0;
 while (true) {
  if (index < 0 || index >= bitSetLength) {
   break;
  }
  index = found.nextClearBit(index);
  if (index < 0 || index >= bitSetLength) {
   break;
  }
  if (elems.contains(uids[index])) {
   found.set(index);
   ret++;
  } else {
  }
  index++;
 }
 return ret;
}
origin: it.unimi.dsi/fastutil

@Override
public boolean addAll(LongCollection c) {
  if (f <= .5)
    ensureCapacity(c.size()); // The resulting collection will be sized for c.size() elements
  else
    tryCapacity(size() + c.size()); // The resulting collection will be tentatively sized for size() + c.size()
                    // elements
  return super.addAll(c);
}
@Override
origin: it.unimi.dsi/fastutil

/**
 * Creates a new hash set using elements provided by a type-specific iterator.
 *
 * @param i
 *            a type-specific iterator whose elements will fill the set.
 * @param f
 *            the load factor.
 */
public LongLinkedOpenHashSet(final LongIterator i, final float f) {
  this(DEFAULT_INITIAL_SIZE, f);
  while (i.hasNext())
    add(i.nextLong());
}
/**
origin: it.unimi.dsi/fastutil

/**
 * Creates a new hash set copying a given type-specific collection.
 *
 * @param c
 *            a type-specific collection to be copied into the new hash set.
 * @param f
 *            the load factor.
 */
public LongLinkedOpenHashSet(final LongCollection c, final float f) {
  this(c.size(), f);
  addAll(c);
}
/**
it.unimi.dsi.fastutil.longsLongLinkedOpenHashSet

Javadoc

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

Instances of this class use a hash table to represent a set. 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 sets 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.

Iterators generated by this set will enumerate elements in the same order in which they have been added to the set (addition of elements already present in the set does not change the iteration order). Note that this order has nothing in common with the natural order of the keys. The order is kept by means of a doubly linked list, represented via an array of longs parallel to the table.

This class implements the interface of a sorted set, so to allow easy access of the iteration order: for instance, you can get the first element in iteration order with first() without having to create an iterator; however, this class partially violates the java.util.SortedSetcontract because all subset methods throw an exception and #comparator() returns always null.

Additional methods, such as addAndMoveToFirst(), make it easy to use instances of this class as a cache (e.g., with LRU policy).

The iterators provided by this class are type-specific java.util.ListIterator, and can be started at any element which is in the set (if the provided element is not in the set, a NoSuchElementException exception will be thrown). If, however, the provided element is not the first or last element in the set, the first access to the list index will require linear time, as in the worst case the entire set must be scanned in iteration order to retrieve the positional index of the starting element. If you use just the methods of a type-specific it.unimi.dsi.fastutil.BidirectionalIterator, however, all operations will be performed in constant time.

Most used methods

  • size
  • <init>
    Creates a new hash set and fills it with the elements of a given array.
  • add
  • clear
  • iterator
    Returns a type-specific list iterator on the elements in this set, starting from a given element of
  • addAll
  • addAndMoveToFirst
    Adds a key to the set; if the key is already present, it is moved to the first position of the itera
  • contains
  • ensureCapacity
  • firstLong
    Returns the first element of this set in iteration order.
  • fixPointers
    Modifies the #link vector for a shift from s to d. This method will complete in constant time.
  • moveIndexToFirst
  • fixPointers,
  • moveIndexToFirst,
  • moveIndexToLast,
  • realSize,
  • rehash,
  • remove,
  • removeEntry,
  • removeNullEntry,
  • retainAll,
  • shiftKeys

Popular in Java

  • Start an intent from android
  • putExtra (Intent)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • BitSet (java.util)
    The BitSet class implements abit array [http://en.wikipedia.org/wiki/Bit_array]. Each element is eit
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Modifier (javassist)
    The Modifier class provides static methods and constants to decode class and member access modifiers
  • Options (org.apache.commons.cli)
    Main entry-point into the library. Options represents a collection of Option objects, which describ
  • Github Copilot 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