public static TupleSchema of(String name, TupleSlot...slots) {
if (name == null) throw new IllegalArgumentException("name must not be null");
if (slots == null) throw new IllegalArgumentException("slots must not be null");
Map<String, Integer> slotLookup = IntStream.range(0, slots.length)
.collect(HashMap::new, (m, i) -> m.put(slots[i].getName(), i), Map::putAll);
if (slots.length != slotLookup.size()) throw new IllegalArgumentException("Slot names are not unique");
return new TupleSchema(name, slots, slotLookup);
}