-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d4b2c36
commit 9f26478
Showing
5 changed files
with
51 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.jsoup.internal; | ||
|
||
import java.util.*; | ||
import java.util.function.Function; | ||
|
||
/** | ||
* An internal class containing functions for use with {@link Map#computeIfAbsent(Object, Function)}. | ||
*/ | ||
public class Functions { | ||
private Functions() { | ||
} | ||
|
||
public static <T, U> Function<T, List<U>> listFunction() { | ||
return key -> new ArrayList<>(); | ||
} | ||
|
||
public static <T, U> Function<T, Set<U>> setFunction() { | ||
return key -> new HashSet<>(); | ||
} | ||
|
||
public static <T, K, V> Function<T, Map<K, V>> mapFunction() { | ||
return key -> new HashMap<>(); | ||
} | ||
|
||
public static <T, K, V> Function<T, IdentityHashMap<K, V>> identityMapFunction() { | ||
return key -> new IdentityHashMap<>(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters