Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- a, b = method();
- return a, b;
- Object[] results = method();
- a, b = results;
- Tuple key = new Tuple(keyPart1, keyPart2, ..., keyPartN);
- hashMap.put(key, value);
- public Map.Entry<String, String> tuple(String key, String value) {
- Map<String, String> map = new HashMap<String, String>();
- map.put(key, value);
- return map.entrySet().iterator().next();
- }
- // Constructor from components
- public Tuple2(A item1Init, B item2Init)
- {
- item1 = item1Init;
- item2 = item2Init;
- }
- // Constructor from another Tuple2 with the same types:
- public Tuple2(Tuple2 <A, B> anotherTuple2)
- {
- item1 = anotherTuple2.item1;
- item2 = anotherTuple2.item2;
- }
- // No getters/setters are needed/possible because the components are public/final.
- public class MyClass {
- private Integer intField;
- private String stringField;
- private Date dateField;
- public MyClass(Integer intField, String stringField, Date dateField) {
- this.intField = intField;
- this.stringField = stringField;
- this.dateField = dateField;
- }
- public Date getDateField() {
- return dateField;
- }
- public void setDateField(Date dateField) {
- this.dateField = dateField;
- }
- public Integer getIntField() {
- return intField;
- }
- public void setIntField(Integer intField) {
- this.intField = intField;
- }
- public String getStringField() {
- return stringField;
- }
- public void setStringField(String stringField) {
- this.stringField = stringField;
- }
- }
- public case class Myclass(Integer intField, String stringField, Date dateField);
- public class TuplePair<X, Y, Z> {
- private final X first;
- private final Y second;
- private final Z third;
- public TuplePair(X f, Y s, Z z) {
- first = f;
- second = s;
- third = z;
- }
- ...
- ...
- }
- Map.Entry<String, Boolean> tuple = new AbstractMap.SimpleEntry<String, Boolean>("test",false);
- class Tuple {
- Object[] list;
- Tuple(Object... value) {
- list = value;
- }
- Object[] get() {
- return list;
- }
- }
- val1, val2 = obj.method()
Add Comment
Please, Sign In to add comment