Container to ease passing around a tuple of two objects. This object provides a sensible implementation of equals(), returning
true if equals() is true on each of the contained objects.
private Pair<String, Integer> getPair(){
return new Pair<String, Integer>("hello", 123);
}
public void testPair() {
Pair<String, Integer> pair = getPair();
Log.e("scrat", pair.first);
Log.e("scrat", String.valueOf(pair.second));
}参考
http://developer.android.com/reference/android/util/Pair.html
本文介绍如何利用Android中的Pair类来简化两个对象的组合与传递过程,并通过一个具体示例展示了Pair对象的创建和使用方法。
1314

被折叠的 条评论
为什么被折叠?



