code stringlengths 23 201k | docstring stringlengths 17 96.2k | func_name stringlengths 0 235 | language stringclasses 1
value | repo stringlengths 8 72 | path stringlengths 11 317 | url stringlengths 57 377 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
default V last() {
return nth(size() - 1);
} | @param startIndex The inclusive starting index
@param endIndex The exclusive ending index
@return a sorted map representing all entries within {@code [startIndex, endIndex)} | last | java | lacuna/bifurcan | src/io/lacuna/bifurcan/ISortedSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/ISortedSet.java | MIT |
public static <V> LinearList<V> of(V... elements) {
LinearList<V> list = new LinearList<V>(elements.length);
for (V e : elements) {
list.addLast(e);
}
return list;
} | A simple implementation of a mutable list combining the best characteristics of {@link java.util.ArrayList} and
{@link java.util.ArrayDeque}, allowing elements to be added and removed from both ends of the collection <i>and</i>
allowing random-access reads and updates. Unlike {@link List}, it can only hold {@code Inte... | of | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
public static <V> LinearList<V> from(Collection<V> collection) {
return collection.stream().collect(Lists.linearCollector(collection.size()));
} | @return a list containing the entries of {@code collection} | from | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
public static <V> LinearList<V> from(Iterable<V> iterable) {
return from(iterable.iterator());
} | @return a list containing the elements of {@code iterable} | from | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
public static <V> LinearList<V> from(Iterator<V> iterator) {
LinearList<V> list = new LinearList<V>();
iterator.forEachRemaining(list::addLast);
return list;
} | @return a list containing all remaining elements of {@code iterator} | from | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
public static <V> LinearList<V> from(IList<V> list) {
if (list.size() > Integer.MAX_VALUE) {
throw new IllegalArgumentException("LinearList cannot hold more than 1 << 30 entries");
} else if (list instanceof LinearList) {
return ((LinearList<V>) list).clone();
} else {
return list.stream()... | @return a list containing the elements of {@code list} | from | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
private void resize(int newCapacity) {
Object[] nElements = new Object[newCapacity];
int truncatedSize = Math.min(size, elements.length - offset);
System.arraycopy(elements, offset, nElements, 0, truncatedSize);
if (size != truncatedSize) {
System.arraycopy(elements, 0, nElements, truncatedSize,... | @param capacity the initial capacity of the list | resize | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public boolean isLinear() {
return true;
} | @param capacity the initial capacity of the list | isLinear | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public LinearList<V> addLast(V value) {
if (size == elements.length) {
resize(size << 1);
}
elements[(offset + size++) & mask] = value;
super.hash = -1;
return this;
} | @param capacity the initial capacity of the list | addLast | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public LinearList<V> addFirst(V value) {
if (size == elements.length) {
resize(size << 1);
}
offset = (offset - 1) & mask;
elements[offset] = value;
size++;
super.hash = -1;
return this;
} | @param capacity the initial capacity of the list | addFirst | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public LinearList<V> removeFirst() {
if (size == 0) {
return this;
}
offset = (offset + 1) & mask;
size--;
super.hash = -1;
return this;
} | @param capacity the initial capacity of the list | removeFirst | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public LinearList<V> removeLast() {
if (size == 0) {
return this;
}
elements[(offset + --size) & mask] = null;
super.hash = -1;
return this;
} | @param capacity the initial capacity of the list | removeLast | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
public LinearList<V> clear() {
Arrays.fill(elements, null);
offset = 0;
size = 0;
super.hash = -1;
return this;
} | @param capacity the initial capacity of the list | clear | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public LinearList<V> set(long idx, V value) {
if (idx == size) {
return addLast(value);
} else if (idx > Integer.MAX_VALUE) {
throw new IndexOutOfBoundsException();
}
elements[(int) (offset + (int) idx) & mask] = value;
super.hash = -1;
return this;
} | @param capacity the initial capacity of the list | set | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
LinearList<V> linearConcat(IList<V> l) {
long newSize = size() + l.size();
if (newSize > Integer.MAX_VALUE) {
throw new IllegalArgumentException("cannot hold more than 1 << 31 entries");
}
if (l instanceof LinearList) {
LinearList<V> list = (LinearList<V>) l;
if (offset != 0 || newSi... | @param capacity the initial capacity of the list | linearConcat | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public V nth(long idx) {
if (idx < 0 || idx >= size) {
throw new IndexOutOfBoundsException(idx + " must be within [0," + size + ")");
}
return (V) elements[(offset + (int) idx) & mask];
} | @param capacity the initial capacity of the list | nth | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
public V popFirst() {
V val = first();
removeFirst();
return val;
} | Removes, and returns, the first element of the list.
@return the first element of the list
@throws IndexOutOfBoundsException if the list is empty | popFirst | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
public V popLast() {
V val = last();
removeLast();
return val;
} | Removes, and returns, the last element of the list.
@return the last element of the list
@throws IndexOutOfBoundsException if the list is empty | popLast | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public Iterator<V> iterator() {
return new Iterator<V>() {
final int limit = offset + size;
int idx = offset;
@Override
public boolean hasNext() {
return idx != limit;
}
@Override
public V next() {
if (idx == limit) {
throw new NoSu... | Removes, and returns, the last element of the list.
@return the last element of the list
@throws IndexOutOfBoundsException if the list is empty | iterator | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public boolean hasNext() {
return idx != limit;
} | Removes, and returns, the last element of the list.
@return the last element of the list
@throws IndexOutOfBoundsException if the list is empty | hasNext | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public V next() {
if (idx == limit) {
throw new NoSuchElementException();
}
V val = (V) elements[idx++ & mask];
return val;
} | Removes, and returns, the last element of the list.
@return the last element of the list
@throws IndexOutOfBoundsException if the list is empty | next | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public long size() {
return size;
} | Removes, and returns, the last element of the list.
@return the last element of the list
@throws IndexOutOfBoundsException if the list is empty | size | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public IList<V> forked() {
return List.from(this);
} | Removes, and returns, the last element of the list.
@return the last element of the list
@throws IndexOutOfBoundsException if the list is empty | forked | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public IList<V> linear() {
return this;
} | Removes, and returns, the last element of the list.
@return the last element of the list
@throws IndexOutOfBoundsException if the list is empty | linear | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
@Override
public LinearList<V> clone() {
LinearList<V> l = new LinearList<V>(size, elements.clone());
l.offset = offset;
return l;
} | Removes, and returns, the last element of the list.
@return the last element of the list
@throws IndexOutOfBoundsException if the list is empty | clone | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearList.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearList.java | MIT |
public static <K, V> LinearMap<K, V> from(IMap<K, V> map) {
if (map instanceof LinearMap) {
return ((LinearMap<K, V>) map).clone();
} else {
LinearMap<K, V> result = new LinearMap<K, V>((int) map.size(), map.keyHash(), map.keyEquality());
map.forEach(e -> result.put(e.key(), e.value()));
... | @return a copy of {@code map}, with the same equality semantics | from | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
public static <K, V> LinearMap<K, V> from(Iterator<IEntry<K, V>> iterator) {
LinearMap<K, V> m = new LinearMap<>();
iterator.forEachRemaining(e -> m.put(e.key(), e.value()));
return m;
} | @return a map representing all remaining entries in {@code iterator} | from | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
public static <K, V> LinearMap<K, V> from(Collection<Entry<K, V>> collection) {
return collection.stream().collect(Maps.linearCollector(Entry::getKey, Entry::getValue, collection.size()));
} | @return a map representing the entries in {@code collection} | from | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public ToLongFunction<K> keyHash() {
return hashFn;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | keyHash | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public BiPredicate<K, K> keyEquality() {
return equalsFn;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | keyEquality | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public LinearMap<K, V> put(K key, V value) {
return put(key, value, Maps.MERGE_LAST_WRITE_WINS);
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | put | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public LinearMap<K, V> put(K key, V value, BinaryOperator<V> merge) {
if ((size << 1) == entries.length) {
resize(size << 1);
}
put(keyHash(key), key, value, merge);
super.hash = -1;
return this;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | put | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public LinearMap<K, V> remove(K key) {
int idx = tableIndex(keyHash(key), key);
if (idx >= 0) {
long row = table[idx];
size--;
int keyIndex = Row.keyIndex(row);
int lastKeyIndex = size << 1;
// if we're not the last entry, swap the last entry into our slot, so we rema... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | remove | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
public LinearMap<K, V> clear() {
Arrays.fill(entries, null);
Arrays.fill(table, 0);
size = 0;
super.hash = -1;
return this;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | clear | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public <U> LinearMap<K, U> mapValues(BiFunction<K, V, U> f) {
LinearMap m = clone();
for (int i = 0; i < m.size(); i++) {
int idx = i << 1;
m.entries[idx + 1] = f.apply((K) m.entries[idx], (V) m.entries[idx + 1]);
}
return m;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | mapValues | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public V get(K key, V defaultValue) {
int idx = tableIndex(keyHash(key), key);
if (idx >= 0) {
long row = table[idx];
return (V) entries[Row.keyIndex(row) + 1];
} else {
return defaultValue;
}
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | get | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public LinearMap<K, V> update(K key, UnaryOperator<V> update) {
int idx = tableIndex(keyHash(key), key);
if (idx >= 0) {
long row = table[idx];
int valIdx = Row.keyIndex(row) + 1;
entries[valIdx] = update.apply((V) entries[valIdx]);
super.hash = -1;
} else {
put(key... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | update | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public ISet<K> keys() {
return new LinearSet<K>((LinearMap<K, Void>) this);
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | keys | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public OptionalLong indexOf(K key) {
int idx = tableIndex(keyHash(key), key);
return idx >= 0 ? OptionalLong.of(Row.keyIndex(table[idx]) >> 1) : OptionalLong.empty();
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | indexOf | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public IEntry<K, V> nth(long index) {
int idx = ((int) index) << 1;
return IEntry.of((K) entries[idx], (V) entries[idx + 1]);
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | nth | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public long size() {
return size;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | size | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public boolean isLinear() {
return true;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | isLinear | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public IMap<K, V> forked() {
return new Map<K,V>(hashFn, equalsFn).merge(this, Maps.MERGE_LAST_WRITE_WINS);
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | forked | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public IMap<K, V> linear() {
return this;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | linear | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public boolean equals(Object obj) {
if (obj instanceof IMap) {
return Maps.equals(this, (IMap<K, V>) obj);
}
return false;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | equals | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public LinearMap<K, V> clone() {
LinearMap<K, V> m = new LinearMap<K, V>(table.length, entries.length, hashFn, equalsFn);
m.size = size;
m.indexMask = indexMask;
arraycopy(table, 0, m.table, 0, table.length);
arraycopy(entries, 0, m.entries, 0, size << 1);
return m;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | clone | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public int hashCode() {
if (super.hash == -1) {
super.hash = 0;
for (long row : table) {
if (Row.populated(row)) {
V value = (V) entries[Row.keyIndex(row) + 1];
super.hash += (Row.hash(row) * 31) + Objects.hashCode(value);
}
}
}
return super... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | hashCode | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public List<LinearMap<K, V>> split(int parts) {
parts = Math.min(parts, size);
List<LinearMap<K, V>> list = new List<LinearMap<K, V>>().linear();
if (parts <= 1) {
return list.addLast(this).forked();
}
int partSize = table.length / parts;
for (int p = 0; p < parts; p++) {
... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | split | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public LinearMap<K, V> union(IMap<K, V> m) {
return merge(m, Maps.MERGE_LAST_WRITE_WINS);
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | union | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public LinearMap<K, V> merge(IMap<K, V> m, BinaryOperator<V> mergeFn) {
if (m.size() == 0) {
return this.clone();
} else if (m instanceof LinearMap && Maps.equivEquality(this, m)) {
return merge((LinearMap<K, V>) m, mergeFn);
} else {
LinearMap<K, V> result = this.clone();
... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | merge | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public LinearMap<K, V> difference(IMap<K, ?> m) {
if (m instanceof LinearMap && Maps.equivEquality(this, m)) {
return difference((LinearMap<K, ?>) m);
} else {
return (LinearMap<K, V>) Maps.difference(this.clone(), m.keys());
}
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | difference | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public IMap<K, V> difference(ISet<K> keys) {
if (keys instanceof LinearSet && Maps.equivEquality(this, keys)) {
return difference(((LinearSet<K>) keys).map);
} else {
return Maps.difference(this.clone(), keys);
}
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | difference | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public LinearMap<K, V> intersection(IMap<K, ?> m) {
if (m instanceof LinearMap && Maps.equivEquality(this, m)) {
return intersection((LinearMap<K, ?>) m);
} else {
return (LinearMap<K, V>) Maps.intersection(new LinearMap<>(), this, m.keys());
}
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | intersection | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public LinearMap<K, V> intersection(ISet<K> keys) {
if (keys instanceof LinearSet && Maps.equivEquality(this, keys)) {
return intersection(((LinearSet<K>) keys).map);
} else {
return (LinearMap<K, V>) Maps.intersection(new LinearMap<>(), this, keys);
}
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | intersection | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public boolean containsAll(ISet<K> set) {
if (set instanceof LinearSet) {
return isSubset(((LinearSet<K>) set).map);
} else {
return set.elements().stream().allMatch(this::contains);
}
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | containsAll | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public boolean containsAll(IMap<K, ?> map) {
if (map instanceof LinearMap) {
return isSubset((LinearMap<K, ?>) map);
} else {
return map.keys().stream().allMatch(this::contains);
}
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | containsAll | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public boolean containsAny(ISet<K> set) {
if (size() < set.size()) {
return set.containsAny(this);
}
if (set instanceof LinearSet) {
return intersects(((LinearSet<K>) set).map);
} else {
return set.elements().stream().anyMatch(this::contains);
}
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | containsAny | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
@Override
public boolean containsAny(IMap<K, ?> map) {
if (size() < map.size()) {
return map.containsAny(this);
}
if (map instanceof LinearMap) {
return intersects((LinearMap<K, ?>) map);
} else {
return map.keys().stream().anyMatch(this::contains);
}
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | containsAny | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
LinearMap<K, V> merge(LinearMap<K, V> m, BinaryOperator<V> mergeFn) {
if (m.size > size) {
return m.merge(this, (x, y) -> mergeFn.apply(y, x));
}
LinearMap<K, V> result = this.clone();
result.resize(result.size + m.size);
for (long row : m.table) {
if (Row.populated(row)) {
int... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | merge | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
LinearMap<K, V> difference(LinearMap<K, ?> m) {
LinearMap<K, V> result = new LinearMap<>(size);
combine(m, result, i -> i == -1);
return result;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | difference | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
LinearMap<K, V> intersection(LinearMap<K, ?> m) {
LinearMap<K, V> result = new LinearMap<>(Math.min(size, (int) m.size()));
combine(m, result, i -> i != -1);
return result;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | intersection | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private boolean isSubset(LinearMap<K, ?> m) {
for (long row : m.table) {
if (Row.populated(row)) {
int currKeyIndex = Row.keyIndex(row);
K currKey = (K) m.entries[currKeyIndex];
if (m.tableIndex(Row.hash(row), currKey) == -1) {
return false;
}
}
}
retur... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | isSubset | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private boolean intersects(LinearMap<K, ?> m) {
for (long row : m.table) {
if (Row.populated(row)) {
int currKeyIndex = Row.keyIndex(row);
K currKey = (K) m.entries[currKeyIndex];
if (m.tableIndex(Row.hash(row), currKey) != -1) {
return true;
}
}
}
retu... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | intersects | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private void combine(LinearMap<K, ?> m, LinearMap<K, V> result, IntPredicate indexPredicate) {
for (long row : table) {
if (Row.populated(row)) {
int currKeyIndex = Row.keyIndex(row);
K currKey = (K) entries[currKeyIndex];
int entryIndex = m.tableIndex(Row.hash(row), currKey);
... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | combine | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private void resize(int tableLength, int entriesLength) {
indexMask = tableLength - 1;
// update table
if (table == null) {
table = new long[tableLength];
} else if (table.length != tableLength) {
long[] oldTable = table;
this.table = new long[tableLength];
for (long row : oldTa... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | resize | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private void resize(int capacity) {
if (capacity > MAX_CAPACITY) {
throw new IllegalStateException("the map cannot be larger than " + MAX_CAPACITY);
}
capacity = Math.max(4, capacity);
int tableLength = 1 << log2Ceil((long) Math.ceil(capacity / LOAD_FACTOR));
resize(tableLength, capacity << ... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | resize | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private int tableIndex(int hash, K key) {
for (int idx = estimatedIndex(hash), dist = 0; ; idx = nextIndex(idx), dist++) {
long row = table[idx];
int currHash = Row.hash(row);
if (currHash == hash && !Row.tombstone(row) && equalsFn.test(key, (K) entries[Row.keyIndex(row)])) {
return idx;
... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | tableIndex | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private void putTable(int hash, int keyIndex, int tableIndex) {
int tombstoneIdx = -1;
// TODO: remove abs
for (int idx = tableIndex, dist = probeDistance(hash, tableIndex), abs = 0; ; idx = nextIndex(idx), dist++, abs++) {
long row = table[idx];
int currHash = Row.hash(row);
boolean isTo... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | putTable | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private void putEntry(int keyIndex, K key, V value) {
entries[keyIndex] = key;
entries[keyIndex + 1] = value;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | putEntry | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private void putTable(int hash, int keyIndex) {
putTable(hash, keyIndex, estimatedIndex(hash));
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | putTable | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private boolean putCheckEquality(int idx, K key, V value, BinaryOperator<V> mergeFn) {
long row = table[idx];
int keyIndex = Row.keyIndex(row);
K currKey = (K) entries[keyIndex];
if (equalsFn.test(key, currKey)) {
entries[keyIndex + 1] = mergeFn.apply((V) entries[keyIndex + 1], value);
retur... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | putCheckEquality | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private void put(int hash, K key, V value, BinaryOperator<V> mergeFn) {
int tombstoneIdx = -1;
for (int idx = estimatedIndex(hash), dist = 0; ; idx = nextIndex(idx), dist++) {
long row = table[idx];
int currHash = Row.hash(row);
boolean isNone = currHash == NONE;
boolean isTombstone = Ro... | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | put | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
static long construct(int hash, int keyIndex) {
return (hash & HASH_MASK) | (keyIndex & KEY_INDEX_MASK) << 32;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | construct | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
static int hash(long row) {
return (int) (row & HASH_MASK);
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | hash | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
static boolean populated(long row) {
return (row & HASH_MASK) != NONE && (row & TOMBSTONE_MASK) == 0;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | populated | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
static int keyIndex(long row) {
return (int) ((row >> 32) & KEY_INDEX_MASK);
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | keyIndex | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
static boolean tombstone(long row) {
return (row & TOMBSTONE_MASK) != 0;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | tombstone | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
static long addTombstone(long row) {
return row | TOMBSTONE_MASK;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | addTombstone | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
static long removeTombstone(long row) {
return row & ~TOMBSTONE_MASK;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | removeTombstone | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private int estimatedIndex(int hash) {
return hash & indexMask;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | estimatedIndex | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private int nextIndex(int idx) {
return (idx + 1) & indexMask;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | nextIndex | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private int probeDistance(int hash, int index) {
return (index + table.length - (hash & indexMask)) & indexMask;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | probeDistance | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
private int keyHash(K key) {
long hash64 = hashFn.applyAsLong(key);
int hash = (int) ((hash64 >> 32) ^ hash64);
// make sure we don't have too many collisions in the lower bits
hash ^= (hash >>> 20) ^ (hash >>> 12);
hash ^= (hash >>> 7) ^ (hash >>> 4);
return hash == NONE ? FALLBACK : hash;
} | @param initialCapacity the initial capacity of the map
@param hashFn a function which yields the hash value of keys
@param equalsFn a function which checks equality of keys | keyHash | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearMap.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearMap.java | MIT |
public static <V> LinearSet<V> from(IList<V> list) {
return from(list.toList());
} | @return a set containing the elements in {@code list} | from | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
public static <V> LinearSet<V> from(java.util.Collection<V> collection) {
return collection.stream().collect(Sets.linearCollector(collection.size()));
} | @return a set containing the elements in {@code collection} | from | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
public static <V> LinearSet<V> from(Iterator<V> iterator) {
LinearSet<V> set = new LinearSet<V>();
iterator.forEachRemaining(set::add);
return set;
} | @return a set containing the remaining elements in {@code iterator} | from | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
public static <V> LinearSet<V> from(Iterable<V> iterable) {
return from(iterable.iterator());
} | @return a set containing the elements in {@code iterable} | from | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
public static <V> LinearSet<V> from(ISet<V> set) {
if (set instanceof LinearSet) {
return ((LinearSet<V>) set).clone();
} else {
LinearSet<V> result = new LinearSet<V>((int) set.size(), set.valueHash(), set.valueEquality());
set.forEach(result::add);
return result;
}
} | @return a set containing the same elements as {@code set}, with the same equality semantics | from | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
@Override
public boolean isLinear() {
return true;
} | @param hashFn the hash function used by the set
@param equalsFn the equality semantics used by the set | isLinear | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
@Override
public ToLongFunction<V> valueHash() {
return map.keyHash();
} | @param hashFn the hash function used by the set
@param equalsFn the equality semantics used by the set | valueHash | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
@Override
public BiPredicate<V, V> valueEquality() {
return map.keyEquality();
} | @param hashFn the hash function used by the set
@param equalsFn the equality semantics used by the set | valueEquality | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
@Override
public LinearSet<V> add(V value) {
map.put(value, null);
return this;
} | @param hashFn the hash function used by the set
@param equalsFn the equality semantics used by the set | add | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
@Override
public LinearSet<V> remove(V value) {
map.remove(value);
return this;
} | @param hashFn the hash function used by the set
@param equalsFn the equality semantics used by the set | remove | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
public LinearSet<V> clear() {
map.clear();
return this;
} | @param hashFn the hash function used by the set
@param equalsFn the equality semantics used by the set | clear | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
@Override
public boolean contains(V value) {
return map.contains(value);
} | @param hashFn the hash function used by the set
@param equalsFn the equality semantics used by the set | contains | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
@Override
public long size() {
return map.size();
} | @param hashFn the hash function used by the set
@param equalsFn the equality semantics used by the set | size | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
@Override
public OptionalLong indexOf(V element) {
return map.indexOf(element);
} | @param hashFn the hash function used by the set
@param equalsFn the equality semantics used by the set | indexOf | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
@Override
public V nth(long idx) {
return map.nth(idx).key();
} | @param hashFn the hash function used by the set
@param equalsFn the equality semantics used by the set | nth | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
@Override
public Iterator<V> iterator() {
final Object[] entries = map.entries;
return Iterators.range(size(), i -> (V) entries[(int) i << 1]);
} | @param hashFn the hash function used by the set
@param equalsFn the equality semantics used by the set | iterator | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
@Override
public <U> LinearMap<V, U> zip(Function<V, U> f) {
return map.mapValues((k, v) -> f.apply(k));
} | @param hashFn the hash function used by the set
@param equalsFn the equality semantics used by the set | zip | java | lacuna/bifurcan | src/io/lacuna/bifurcan/LinearSet.java | https://github.com/lacuna/bifurcan/blob/master/src/io/lacuna/bifurcan/LinearSet.java | MIT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.