Is there anything similar in Trove to Java's Collections.singleton
, Collections.singletonList
, or singletonMap
?
I'm working in a application that uses many of the trove collections to reduce memory foot print. However, I have been unable to find any singleton Trove collections. For example, creating a TLongHashSet
with 1 element using the default constructor will result in a TLongHashSet
with an underlying array of 23 elements. Even when specifying the initial size and load factor as 1 and 1 will still result in an underlying array of 5 elements (Trove's the lowest prime is 5 based on gnu.trove.impl.PrimeFinder
). In additional to the underlying array there are additional class variables that could be removed for a singleton implementation.