finished documentation for class Pair
This commit is contained in:
parent
8aed4bbd3b
commit
98f4bb6e1a
@ -3,52 +3,72 @@ package fr.packageviewer;
|
|||||||
/**
|
/**
|
||||||
* The Pair class stores two objects of distinct type
|
* The Pair class stores two objects of distinct type
|
||||||
*
|
*
|
||||||
* @author C.Marla, R.Thomas, S.Djalim
|
* @author R.Thomas
|
||||||
* @version 1.0
|
* @version 1.0
|
||||||
*/
|
*/
|
||||||
public class Pair<K,V> {
|
public class Pair<K, V> {
|
||||||
private K first;
|
private K first;
|
||||||
private V second;
|
private V second;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Empty Constructor for the Pair class
|
||||||
*/
|
*/
|
||||||
public Pair() {
|
public Pair() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Main Constructor for the Pair class
|
||||||
*
|
*
|
||||||
* @param first
|
* @param first, the first object to be stored
|
||||||
* @param second
|
* @param second the second object to be stored
|
||||||
*/
|
*/
|
||||||
public Pair(K first, V second) {
|
public Pair(K first, V second) {
|
||||||
this.first = first;
|
this.first = first;
|
||||||
this.second = second;
|
this.second = second;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Getter for the attribute first
|
||||||
*
|
*
|
||||||
* @return
|
* @return the object stored in the attribute first
|
||||||
*/
|
*/
|
||||||
public K getFirst() {
|
public K getFirst() {
|
||||||
return first;
|
return first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter for the attribute first
|
||||||
|
*
|
||||||
|
* @param first Store the given object in the attribute first
|
||||||
|
*/
|
||||||
public void setFirst(K first) {
|
public void setFirst(K first) {
|
||||||
this.first = first;
|
this.first = first;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Getter for the attribute second
|
||||||
*
|
*
|
||||||
* @return
|
* @return the object stored in the attribute second
|
||||||
*/
|
*/
|
||||||
public V getSecond() {
|
public V getSecond() {
|
||||||
return second;
|
return second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setter for the attribute second
|
||||||
|
*
|
||||||
|
* @param second Store the given object in the attribute second
|
||||||
|
*/
|
||||||
public void setSecond(V second) {
|
public void setSecond(V second) {
|
||||||
this.second = second;
|
this.second = second;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns a string reprensentation of the pair
|
||||||
|
*
|
||||||
|
* @return String, string reprensentation of the pair
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public String toString() {
|
public String toString() {
|
||||||
return "Pair{key=%s,value=%s}".formatted(first, second);
|
return "Pair{key=%s,value=%s}".formatted(first, second);
|
||||||
|
Loading…
Reference in New Issue
Block a user