@Internal public class ItemIdentitySet extends AbstractSet<ItemIdentity>
An implementation of a Set of ItemIdentity, optimized for memory consumption and objects count.
Statistics: compared to HashSet, 4x less memory taken, 1.5x slower. The number of objects is ~ 10 (compared to N*2 with HashSet), if all item IDs are long. String item IDs create K*2 objects as well.
| Constructor and Description |
|---|
ItemIdentitySet() |
ItemIdentitySet(Collection<? extends ItemIdentity> ids) |
ItemIdentitySet(ItemIdentity... ids) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(ItemIdentity id) |
boolean |
addAll(Collection<? extends ItemIdentity> c) |
void |
addAll(String type,
Iterable<String> strings) |
void |
addAll(String type,
LongIterable longs) |
void |
clear() |
static Set<ItemIdentity> |
collectItemIds(RowRetriever rowRetriever,
LongIterable rows) |
boolean |
contains(Object o) |
boolean |
containsAll(Collection<?> c) |
ItemIdentitySet |
copy() |
ItemIdentitySet |
copyAllOfType(String typeId) |
Iterable<String> |
getItemTypes() |
boolean |
isImmutable() |
Iterator<ItemIdentity> |
iterator() |
LongSizedIterable |
longIds(String typeId) |
ItemIdentitySet |
makeImmutable() |
static ItemIdentitySet |
of(String itemType,
Iterable<String> ids) |
static ItemIdentitySet |
of(String itemType,
long[] ids) |
static ItemIdentitySet |
of(String itemType,
LongIterable ids) |
boolean |
remove(Object o) |
boolean |
removeAll(Collection<?> c) |
boolean |
retainAll(Collection<?> c) |
int |
size() |
Set<String> |
stringIds(String typeId) |
equals, hashCodeisEmpty, toArray, toArray, toStringisEmpty, spliterator, toArray, toArrayparallelStream, removeIf, streampublic ItemIdentitySet()
public ItemIdentitySet(ItemIdentity... ids)
public ItemIdentitySet(Collection<? extends ItemIdentity> ids)
public static ItemIdentitySet of(String itemType, long[] ids)
public static ItemIdentitySet of(String itemType, LongIterable ids)
public static ItemIdentitySet of(String itemType, Iterable<String> ids)
@NotNull public Iterator<ItemIdentity> iterator()
iterator in interface Iterable<ItemIdentity>iterator in interface Collection<ItemIdentity>iterator in interface Set<ItemIdentity>iterator in class AbstractCollection<ItemIdentity>public int size()
size in interface Collection<ItemIdentity>size in interface Set<ItemIdentity>size in class AbstractCollection<ItemIdentity>public boolean contains(Object o)
contains in interface Collection<ItemIdentity>contains in interface Set<ItemIdentity>contains in class AbstractCollection<ItemIdentity>public boolean containsAll(@NotNull
Collection<?> c)
containsAll in interface Collection<ItemIdentity>containsAll in interface Set<ItemIdentity>containsAll in class AbstractCollection<ItemIdentity>public boolean add(ItemIdentity id)
add in interface Collection<ItemIdentity>add in interface Set<ItemIdentity>add in class AbstractCollection<ItemIdentity>public boolean addAll(@NotNull
Collection<? extends ItemIdentity> c)
addAll in interface Collection<ItemIdentity>addAll in interface Set<ItemIdentity>addAll in class AbstractCollection<ItemIdentity>public void addAll(@NotNull
String type,
@NotNull
LongIterable longs)
public boolean remove(Object o)
remove in interface Collection<ItemIdentity>remove in interface Set<ItemIdentity>remove in class AbstractCollection<ItemIdentity>public boolean removeAll(Collection<?> c)
removeAll in interface Collection<ItemIdentity>removeAll in interface Set<ItemIdentity>removeAll in class AbstractSet<ItemIdentity>public boolean retainAll(Collection<?> c)
retainAll in interface Collection<ItemIdentity>retainAll in interface Set<ItemIdentity>retainAll in class AbstractCollection<ItemIdentity>public ItemIdentitySet makeImmutable()
public boolean isImmutable()
public void clear()
clear in interface Collection<ItemIdentity>clear in interface Set<ItemIdentity>clear in class AbstractCollection<ItemIdentity>public ItemIdentitySet copyAllOfType(String typeId)
public ItemIdentitySet copy()
public LongSizedIterable longIds(String typeId)
@NotNull public static Set<ItemIdentity> collectItemIds(@NotNull RowRetriever rowRetriever, @Nullable LongIterable rows)
Copyright © 2021 ALM Works. All Rights Reserved.