org.apache.spark.util
Class MutablePair<T1,T2>

Object
  extended by org.apache.spark.util.MutablePair<T1,T2>
All Implemented Interfaces:
java.io.Serializable, scala.Equals, scala.Product, scala.Product2<T1,T2>

public class MutablePair<T1,T2>
extends Object
implements scala.Product2<T1,T2>, scala.Product, scala.Serializable

:: DeveloperApi :: A tuple of 2 elements. This can be used as an alternative to Scala's Tuple2 when we want to minimize object allocation.

param: _1 Element 1 of this MutablePair param: _2 Element 2 of this MutablePair

See Also:
Serialized Form

Constructor Summary
MutablePair()
          No-arg constructor for serialization
MutablePair(T1 _1, T2 _2)
           
 
Method Summary
 T1 _1()
           
 T2 _2()
           
 boolean canEqual(Object that)
           
 String toString()
           
 MutablePair<T1,T2> update(T1 n1, T2 n2)
          Updates this pair with new values and returns itself
 
Methods inherited from class Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface scala.Product2
_1$mcD$sp, _1$mcI$sp, _1$mcJ$sp, _2$mcD$sp, _2$mcI$sp, _2$mcJ$sp, productArity, productElement
 
Methods inherited from interface scala.Product
productIterator, productPrefix
 
Methods inherited from interface scala.Equals
equals
 

Constructor Detail

MutablePair

public MutablePair(T1 _1,
                   T2 _2)

MutablePair

public MutablePair()
No-arg constructor for serialization

Method Detail

_1

public T1 _1()
Specified by:
_1 in interface scala.Product2<T1,T2>

_2

public T2 _2()
Specified by:
_2 in interface scala.Product2<T1,T2>

update

public MutablePair<T1,T2> update(T1 n1,
                                 T2 n2)
Updates this pair with new values and returns itself


toString

public String toString()
Overrides:
toString in class Object

canEqual

public boolean canEqual(Object that)
Specified by:
canEqual in interface scala.Equals