dsmiley commented on code in PR #2932:
URL: https://github.com/apache/solr/pull/2932#discussion_r1910412721


##########
solr/solrj/src/java/org/apache/solr/common/util/SimpleOrderedMap.java:
##########
@@ -67,4 +69,42 @@ public SimpleOrderedMap<T> clone() {
     newList.addAll(nvPairs);
     return new SimpleOrderedMap<>(newList);
   }
+
+  /**
+   * Returns a shared, empty, and immutable instance of SimpleOrderedMap.
+   * @return empty SimpleOrderedMap (immutable) 
+   */
+  public static SimpleOrderedMap<Object> of() {
+    return EMPTY;
+  }
+
+  /**
+   * Returns an immutable instance of SimpleOrderedMap with a single element.
+   * @return List containing the elements
+   */
+  public static SimpleOrderedMap<Object> of(Object o1) {
+    return new SimpleOrderedMap<>(List.of(o1));
+  }

Review Comment:
   This is illogical; the list should be key-value pairs.  SimpleOrderedMap is 
fundamentally a Map.  Look at Map's static "of" methods for inspiration.



##########
solr/solrj/src/java/org/apache/solr/common/util/SimpleOrderedMap.java:
##########
@@ -67,4 +69,42 @@ public SimpleOrderedMap<T> clone() {
     newList.addAll(nvPairs);
     return new SimpleOrderedMap<>(newList);
   }
+
+  /**
+   * Returns a shared, empty, and immutable instance of SimpleOrderedMap.
+   * @return empty SimpleOrderedMap (immutable) 
+   */
+  public static SimpleOrderedMap<Object> of() {
+    return EMPTY;
+  }
+
+  /**
+   * Returns an immutable instance of SimpleOrderedMap with a single element.
+   * @return List containing the elements
+   */
+  public static SimpleOrderedMap<Object> of(Object o1) {
+    return new SimpleOrderedMap<>(List.of(o1));
+  }
+  
+  /**
+   * Returns an immutable instance of SimpleOrderedMap with two elements.
+   * @return List containing the elements
+   */
+  public static SimpleOrderedMap<Object> of(Object o1, Object o2) {
+    return new SimpleOrderedMap<>(List.of(o1,o2));
+  }
+  
+  /**
+   * Returns an immutable instance of SimpleOrderedMap with an arbitrary 
number of elements. 
+   * @return List containing the elements
+   */
+  public static SimpleOrderedMap<Object> of(Object... elements) {

Review Comment:
   Map.of has no similar array based argument so I suggest not doing the same 
here.  Presumably the key and value distinction then becomes less obvious; 
easier to misuse.



##########
solr/solrj/src/java/org/apache/solr/common/util/SimpleOrderedMap.java:
##########
@@ -67,4 +69,42 @@ public SimpleOrderedMap<T> clone() {
     newList.addAll(nvPairs);
     return new SimpleOrderedMap<>(newList);
   }
+
+  /**
+   * Returns a shared, empty, and immutable instance of SimpleOrderedMap.
+   * @return empty SimpleOrderedMap (immutable) 
+   */
+  public static SimpleOrderedMap<Object> of() {
+    return EMPTY;
+  }
+
+  /**
+   * Returns an immutable instance of SimpleOrderedMap with a single element.
+   * @return List containing the elements
+   */
+  public static SimpleOrderedMap<Object> of(Object o1) {
+    return new SimpleOrderedMap<>(List.of(o1));
+  }
+  
+  /**
+   * Returns an immutable instance of SimpleOrderedMap with two elements.
+   * @return List containing the elements
+   */
+  public static SimpleOrderedMap<Object> of(Object o1, Object o2) {

Review Comment:
   named key and value, thus logically one pair



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to