java中id啥意思啊_Java中是否有基本的id / value对象?

哈希地图!

例子:

Map attribut = new HashMap();

attribut.put(1, "hi");

String value = attribut.get(1);你可以迭代:

for (Integer key : attribut.keySet()) {

value = attribut.get(key);

}编辑:

好的,只是一对!

public class Pair {

private final K element0;

private final V element1;

public static Pair createPair(K key, V value) {

return new Pair(key, value);

}

public Pair(K element0, V element1) {

this.element0 = element0;

this.element1 = element1;

}

public K getElement0() {

return element0;

}

public V getElement1() {

return element1;

}

}用法:

Pair pair = Pair.createPair(1, "test");

pair.getElement0();

pair.getElement1();永恒,只有一对!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值