X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fdata%2FProfile.java;h=64aeae4ccd212e6c05d54915632590662e352cd5;hb=3abc078471d7e7516599eda01de011a23c328d63;hp=8dec42a65cdc73a652e33bae048252e240a00fec;hpb=bf6b514d89bb39bd076d9a29bbae0d3590750e8d;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/data/Profile.java b/src/main/java/net/pterodactylus/sone/data/Profile.java index 8dec42a..64aeae4 100644 --- a/src/main/java/net/pterodactylus/sone/data/Profile.java +++ b/src/main/java/net/pterodactylus/sone/data/Profile.java @@ -20,6 +20,7 @@ package net.pterodactylus.sone.data; import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; +import java.util.LinkedHashMap; import java.util.List; import java.util.Map; @@ -332,10 +333,24 @@ public class Profile implements Fingerprintable { * * @return The fields of this profile */ - public List getFields() { + public List getFieldNames() { return Collections.unmodifiableList(fields); } + /** + * Returns all field names and their values, ordered the same way + * {@link #getFieldNames()} returns the names of the fields. + * + * @return All field names and values + */ + public Map getFields() { + Map fields = new LinkedHashMap(); + for (String field : getFieldNames()) { + fields.put(field, getField(field)); + } + return fields; + } + // // PRIVATE METHODS //