Is there a Java data structure that:
There is LinkedHashSet
, but it only allows remove(object)
, add(object)
as per Set
.
LinkedHashSet will allow removal of the first element, just do
Iterator iter = linkedHashSet.iterator();
if(iter.next()) {
iter.remove();
}