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

com.twitter.scrooge.Utilities Maven / Gradle / Ivy

The newest version!
package com.twitter.scrooge;

import java.util.*;

public class Utilities {
  public static class Tuple {
    private A a;
    private B b;

    public Tuple(A a, B b) {
      this.a = a;
      this.b = b;
    }

    A getFirst() {
      return this.a;
    }

    B getSecond() {
      return this.b;
    }
  }

  public static  List makeList(T... elements) {
    return Arrays.asList(elements);
  }

  public static  Map makeMap(Tuple... elements) {
    Map map = new HashMap();
    for (Tuple element : elements) {
      map.put(element.getFirst(), element.getSecond());
    }
    return map;
  }

  public static  Set makeSet(T... elements) {
    Set set = new HashSet();
    for (T element : elements) {
      set.add(element);
    }
    return set;
  }

  public static  Tuple makeTuple(A a, B b) {
    return new Tuple(a, b);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy