All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.tonivade.purefun.Tuple Maven / Gradle / Ivy

/*
 * Copyright (c) 2018-2019, Antonio Gabriel Muñoz Conejo 
 * Distributed under the terms of the MIT License
 */
package com.github.tonivade.purefun;

import java.util.Map;

import com.github.tonivade.purefun.data.Sequence;

public interface Tuple {
  
  Sequence toSequence();

  static  Tuple1 of(A value1) {
    return Tuple1.of(value1);
  }

  static  Tuple2 of(A value1, B value2) {
    return Tuple2.of(value1, value2);
  }

  static  Tuple3 of(A value1, B value2, C value3) {
    return Tuple3.of(value1, value2, value3);
  }

  static  Tuple4 of(A value1, B value2, C value3, D value4) {
    return Tuple4.of(value1, value2, value3, value4);
  }

  static  Tuple5 of(A value1, B value2, C value3, D value4, E value5) {
    return Tuple5.of(value1, value2, value3, value4, value5);
  }

  static  Tuple2 from(Map.Entry entry) {
    return Tuple2.of(entry.getKey(), entry.getValue());
  }
}