summaryrefslogtreecommitdiffstats
path: root/container-search/src/main/java/com/yahoo/search/result/Hit.java
diff options
context:
space:
mode:
Diffstat (limited to 'container-search/src/main/java/com/yahoo/search/result/Hit.java')
-rw-r--r--container-search/src/main/java/com/yahoo/search/result/Hit.java35
1 files changed, 13 insertions, 22 deletions
diff --git a/container-search/src/main/java/com/yahoo/search/result/Hit.java b/container-search/src/main/java/com/yahoo/search/result/Hit.java
index f68916c8a68..15c148b7db7 100644
--- a/container-search/src/main/java/com/yahoo/search/result/Hit.java
+++ b/container-search/src/main/java/com/yahoo/search/result/Hit.java
@@ -21,7 +21,6 @@ import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import java.util.TreeMap;
-import java.util.function.BiConsumer;
import java.util.stream.Collectors;
/**
@@ -402,30 +401,10 @@ public class Hit extends ListenableFreezableClass implements Data, Comparable<Hi
/** Returns the name of the source creating this hit */
public String getSource() { return source; }
- /**
- * Receive a callback on the given object for each field in this hit.
- * This is the most resource efficient way of traversing all the fields of a hit.
- */
- public void forEachField(BiConsumer<String, Object> consumer) {
- if (fields == null) return;
- fields.forEach(consumer);
- }
-
/** Returns the fields of this as a read-only map. This is more costly than fieldIterator() */
+ // TODO Should it be deprecated ?
public Map<String, Object> fields() { return getUnmodifiableFieldMap(); }
- /** Returns a modifiable iterator over the fields of this */
- public Iterator<Map.Entry<String, Object>> fieldIterator() { return getFieldMap().entrySet().iterator(); }
-
- /**
- * Returns the keys of the fields of this hit as a modifiable view.
- * This follows the rules of key sets returned from maps: Key removals are reflected
- * in the map, add and addAll is not supported.
- */
- public Set<String> fieldKeys() {
- return getFieldMap().keySet();
- }
-
/** Allocate room for the given number of fields to avoid resizing. */
public void reserve(int minSize) {
getFieldMap(minSize);
@@ -440,6 +419,9 @@ public class Hit extends ListenableFreezableClass implements Data, Comparable<Hi
return getFieldMap().put(key, value);
}
+ /** Returns a modifiable iterator over the fields of this */
+ public Iterator<Map.Entry<String, Object>> fieldIterator() { return getFieldMap().entrySet().iterator(); }
+
/** Returns a field value or null if not present */
public Object getField(String value) { return fields != null ? fields.get(value) : null; }
@@ -457,6 +439,15 @@ public class Hit extends ListenableFreezableClass implements Data, Comparable<Hi
return getFieldMap().remove(field);
}
+ /**
+ * Returns the keys of the fields of this hit as a modifiable view.
+ * This follows the rules of key sets returned from maps: Key removals are reflected
+ * in the map, add and addAll is not supported.
+ */
+ public Set<String> fieldKeys() {
+ return getFieldMap().keySet();
+ }
+
protected boolean hasField(String name) {
return fields != null && fields.containsKey(name);
}