greenrobot/essentials

LinkedListMultimap

slott opened this issue · 1 comments

slott commented

Why not use LinkedHashMap for the key to preserve order when iterating through the map ?

Or provide a LinkedListMultimap class like

public class LinkedListMultimap<K, V> extends AbstractMultimap<K, V, List<V>> {
	public static <K, V> LinkedListMultimap<K, V> create() {
		return new LinkedListMultimap<>(new LinkedHashMap<K, List<V>>());
	}

	protected LinkedListMultimap(LinkedHashMap<K, List<V>> map) {
		super(map);
	}

	@Override protected List<V> createNewCollection() {
		return new ArrayList<>();
	}
}

I'd be happy to make a PR with this as I'm using this in my own project with great success

I think ArrayList is the default implementation nowadays. Please re-open if I missed something.