Java中的C ++ typedef?

在Java中是否有类似于C ++ typedef / using的东西? 在C ++中我会写

using LatLng = std::pair; 

Java中没有类型别名。

也没有像decltype这样的东西。

最接近decltype的东西可能是使用java中的generics来处理的。

 /** * @author OldCurmudgeon * @param 

- The type of the first. * @param - The type of the second. */ public class Pair

, Q extends Comparable> implements Comparable> { // Exposing p & q directly for simplicity. They are final so this is safe. public final P p; public final Q q; public Pair(P p, Q q) { this.p = p; this.q = q; } public P getP() { return p; } public Q getQ() { return q; } @Override public String toString() { return "<" + (p == null ? "" : p.toString()) + "," + (q == null ? "" : q.toString()) + ">"; } @Override public boolean equals(Object o) { if (!(o instanceof Pair)) { return false; } Pair it = (Pair) o; return p == null ? it.p == null : p.equals(it.p) && q == null ? it.q == null : q.equals(it.q); } @Override public int hashCode() { int hash = 7; hash = 97 * hash + (this.p != null ? this.p.hashCode() : 0); hash = 97 * hash + (this.q != null ? this.q.hashCode() : 0); return hash; } @Override public int compareTo(Pair o) { int diff = p == null ? (op == null ? 0 : -1) : p.compareTo(op); if (diff == 0) { diff = q == null ? (oq == null ? 0 : -1) : q.compareTo(oq); } return diff; } }