Browse Source

feat: new pair with 'of' method

easepan 5 years ago
parent
commit
5440cff37f
1 changed files with 4 additions and 0 deletions
  1. 4 0
      hutool-core/src/main/java/cn/hutool/core/lang/Pair.java

+ 4 - 0
hutool-core/src/main/java/cn/hutool/core/lang/Pair.java

@@ -20,6 +20,10 @@ public class Pair<K, V> extends CloneSupport<Pair<K, V>> implements Serializable
 	private final K key;
 	private final V value;
 
+	public static <K, V> Pair<K, V> of(K key, V value) {
+		return new Pair<>(key, value);
+	}
+
 	/**
 	 * 构造
 	 *