Added getFirstEntryOfMap

This commit is contained in:
Francesco Mangiacrapa 2022-09-19 18:16:23 +02:00
parent d8610c1f54
commit 5c644e8c1e
1 changed files with 9 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package org.gcube.application.geoportalcommon.shared.geoportal;
import java.io.Serializable; import java.io.Serializable;
import java.util.LinkedHashMap; import java.util.LinkedHashMap;
import java.util.Map.Entry;
public class DocumentDV implements Serializable { public class DocumentDV implements Serializable {
@ -19,6 +20,14 @@ public class DocumentDV implements Serializable {
public LinkedHashMap<String, Object> getDocumentAsMap() { public LinkedHashMap<String, Object> getDocumentAsMap() {
return documentAsMap; return documentAsMap;
} }
public Entry<String, Object> getFirstEntryOfMap() {
if(documentAsMap!=null && documentAsMap.size()>1) {
return documentAsMap.entrySet().iterator().next();
}
return null;
}
public String getDocumentAsJSON() { public String getDocumentAsJSON() {
return documentAsJSON; return documentAsJSON;