public class MultiMap_Test {
public static void main(String[] args) {
Multimap myMultimap = ArrayListMultimap.create();
myMu
Why is insertion order not preserved in MultiMap?
In fact, your problem is not with MultiMap but with the selected implementation. ArrayListMultimap uses a HashMap as implementation of the backing Map:
public static ArrayListMultimap create() {
return new ArrayListMultimap();
}
//...
private ArrayListMultimap() {
super(new HashMap>());
expectedValuesPerKey = DEFAULT_VALUES_PER_KEY;
}
And HashMap doesn't preserve the order of the insertion of the elements.