Use LinkedHashMap for PacketExtensions in Packet

to keep the order in which the elements are added.

Some XEPs define a Schema using 'xs:sequence' (see for example XEP-60 §
17.1), so the order the PacketExtensions are added should be the same
they are transformed to a XML String.
This commit is contained in:
Florian Schmaus 2014-11-05 17:58:32 +01:00
parent b9167c5fe2
commit 10643cce7c
1 changed files with 2 additions and 2 deletions

View File

@ -25,7 +25,7 @@ import org.jxmpp.util.XmppStringUtils;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Locale;
import java.util.Map;
@ -62,7 +62,7 @@ public abstract class Packet extends TopLevelStreamElement {
*/
private static final AtomicLong id = new AtomicLong();
private final Map<String, PacketExtension> packetExtensions = new HashMap<String, PacketExtension>(12);
private final Map<String, PacketExtension> packetExtensions = new LinkedHashMap<String, PacketExtension>(12);
private String packetID = null;
private String to = null;