Skip to content

Commit eaa3ae7

Browse files
fliskyvelo
authored andcommitted
simplify valuesOrEmpty (OpenFeign#938)
there are 3 lookups in the map, and one should be sufficient
1 parent 0581250 commit eaa3ae7

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

core/src/main/java/feign/Util.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,8 @@ public static <T> T[] toArray(Iterable<? extends T> iterable, Class<T> type) {
191191
* Returns an unmodifiable collection which may be empty, but is never null.
192192
*/
193193
public static <T> Collection<T> valuesOrEmpty(Map<String, Collection<T>> map, String key) {
194-
return map.containsKey(key) && map.get(key) != null ? map.get(key) : Collections.<T>emptyList();
194+
Collection<T> values = map.get(key);
195+
return values != null ? values : Collections.emptyList();
195196
}
196197

197198
public static void ensureClosed(Closeable closeable) {

0 commit comments

Comments
 (0)