示例#1
0
  static <T> Keyword<T> keyword() {
    Declaration declaration = Declaration.declaration();
    ParameterizedType parameterizedType = (ParameterizedType) declaration.type();

    return Keyword.keyword(
        declaration.name(),
        Unchecked.<Class<T>>cast(parameterizedType.getActualTypeArguments()[0]));
  }
示例#2
0
 public static <K, V, M extends PersistentMap<K, V>> Pair<M, Option<V>> remove(M map, K key) {
   return Pair.pair(Unchecked.<M>cast(map.delete(key)), map.lookup(key));
 }
示例#3
0
 public static <T> LogicalPredicate<T> in(final Iterable<? extends T> iterable) {
   if (Sequences.isEmpty(iterable)) return never();
   return new InPredicate<T>(Unchecked.<Iterable<T>>cast(iterable));
 }
示例#4
0
 public static <K, V, M extends PersistentMap<K, V>> Pair<M, Option<V>> put(
     M map, K key, V newValue) {
   return Pair.pair(Unchecked.<M>cast(map.insert(key, newValue)), map.lookup(key));
 }
示例#5
0
 public Record call(final Record source) throws Exception {
   return keywords.fold(
       Record.constructors.record(),
       (record, keyword) ->
           record.set(Unchecked.<Keyword<Object>>cast(keyword), keyword.call(source)));
 }