tmf: Fix the actual end time of state system modules
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / event / TmfEventField.java
index 501d61c2938e4e3746ebe20949031ca65cef26c0..1ad95b3a6bf40721c3735ec35c158fd5571d391c 100644 (file)
@@ -17,6 +17,7 @@ package org.eclipse.tracecompass.tmf.core.event;
 
 import static org.eclipse.tracecompass.common.core.NonNullUtils.checkNotNull;
 
+import java.util.Arrays;
 import java.util.Collection;
 import java.util.Map;
 
@@ -66,20 +67,16 @@ public class TmfEventField implements ITmfEventField {
      * @throws IllegalArgumentException
      *             If 'name' is null, or if 'fields' has duplicate field names.
      */
-    public TmfEventField(@NonNull String name, @Nullable Object value, @Nullable ITmfEventField[] fields) {
+    public TmfEventField(@NonNull String name, @Nullable Object value, ITmfEventField @Nullable [] fields) {
         fName = name;
         fValue = value;
 
         if (fields == null) {
-            fFields = checkNotNull(ImmutableMap.<String, ITmfEventField> of());
+            fFields = ImmutableMap.of();
         } else {
-            /* Java 8 streams will make this even more simple! */
             ImmutableMap.Builder<String, ITmfEventField> mapBuilder = new ImmutableMap.Builder<>();
-            for (ITmfEventField field : fields) {
-                final String curName = field.getName();
-                mapBuilder.put(curName, field);
-            }
-            fFields = checkNotNull(mapBuilder.build());
+            Arrays.stream(fields).forEach(t -> mapBuilder.put(t.getName(), t));
+            fFields = mapBuilder.build();
         }
     }
 
@@ -113,12 +110,12 @@ public class TmfEventField implements ITmfEventField {
 
     @Override
     public final Collection<String> getFieldNames() {
-        return checkNotNull(fFields.keySet());
+        return fFields.keySet();
     }
 
     @Override
     public final Collection<ITmfEventField> getFields() {
-        return checkNotNull(fFields.values());
+        return fFields.values();
     }
 
     @Override
@@ -146,7 +143,7 @@ public class TmfEventField implements ITmfEventField {
      * @param labels the list of labels
      * @return the (flat) root list
      */
-    public static final ITmfEventField makeRoot(final String[] labels) {
+    public static final @NonNull ITmfEventField makeRoot(final String[] labels) {
         final ITmfEventField[] fields = new ITmfEventField[labels.length];
         for (int i = 0; i < labels.length; i++) {
             String label = checkNotNull(labels[i]);
This page took 0.026258 seconds and 5 git commands to generate.