Package uk.ac.starlink.util
Class Util
java.lang.Object
uk.ac.starlink.util.Util
General class containing utility methods.
Several of these relate to the java.util classes.
- Since:
- 18 Jul 2023
- Author:
- Mark Taylor
-
Method Summary
Modifier and TypeMethodDescriptionstatic <K,
V> boolean containsKey
(Map<K, V> map, K key) Typed map key test operation.static <T> boolean
equals
(T t1, T t2) Typed equality operation.static <K,
V> V Typed map get operation.static <K,
V> V Typed map remove operation.
-
Method Details
-
get
Typed map get operation. This simply callsMap.get(Object)
, but it provides compile-time assurance that the supplied key has the right type.- Parameters:
map
- mapkey
- key- Returns:
- result of map.get(key)
-
containsKey
Typed map key test operation. This simply callsMap.containsKey(Object)
, but it provides compile-time assurance that the supplied key has the right type.- Parameters:
map
- mapkey
- key- Returns:
- result of map.containsKey(key)
-
remove
Typed map remove operation. This simply callsMap.remove(Object)
, but it provides compile-time assurance that the supplied key has the right type.- Parameters:
map
- mapkey
- key- Returns:
- result of map.remove(key)
-
equals
public static <T> boolean equals(T t1, T t2) Typed equality operation. This simply callsObjects.equals(Object,Object)
, but provides compile-time assurance that the two supplied parameters have the same type.- Parameters:
t1
- first objectt2
- second object- Returns:
- result of Objects.equals(t1, t1)
-