Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LinkedHashMap after deserialization has different ordering #5590

scabug opened this issue Mar 20, 2012 · 2 comments


Copy link

commented Mar 20, 2012

Following code:

	  val bos = new ByteArrayOutputStream()
	  val out = new ObjectOutputStream(bos)
	  out.writeObject(LinkedHashMap("a"->"a", "b"->"b", "c"->"c"));	  
	  val arr = bos.toByteArray();
	  val in = new ObjectInputStream(new ByteArrayInputStream(arr));
	  val deser = in.readObject();


Map(c -> c, a -> a, b -> b)

while it should, maintain the original insertion order:

Map(a -> a, b -> b, c -> c)

This comment has been minimized.

Copy link

commented Mar 20, 2012

Imported From:
Reporter: Jarosław Wosik (roeoender)
Affected Versions: 2.9.1, 2.10.0-M2


This comment has been minimized.

Copy link

commented Mar 25, 2012

Jarosław Wosik (roeoender) said:
It seems that LinkedHashMap should have it's own implementation of entriesIterator because the one inherited from HashTable doesn't take the element order into account. "entriesIterator" is used by LinkedHashMap.writeObject > serializeTo > foreachEntry.

@scabug scabug closed this May 4, 2012

@scabug scabug added the minimized label Apr 7, 2017

@scabug scabug added this to the 2.10.0 milestone Apr 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.