Skip to content

Instantly share code, notes, and snippets.

@RobertFischer
Last active August 29, 2015 14:08
Show Gist options
  • Save RobertFischer/fa6e944b5489eea48ee0 to your computer and use it in GitHub Desktop.
Save RobertFischer/fa6e944b5489eea48ee0 to your computer and use it in GitHub Desktop.
Java Type Aliasing
class Aliasing {
// Put your type alias right before the return value.
public static <L extends Long> String parseToHex(String str) {
return L.toHexString(L.parseLong(str));
}
// Use this for when you have some ugly type.
public static <MAP extends Map<String,Set<String>>> boolean addToKey(String key, String value) {
MAP x = service.getKeyMap();
Set<String> strings = x.get(key);
return strings.add(value);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment