io.vavr.collection.HashSet.add()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(1.5k)|赞(0)|评价(0)|浏览(117)

本文整理了Java中io.vavr.collection.HashSet.add()方法的一些代码示例,展示了HashSet.add()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。HashSet.add()方法的具体详情如下:
包路径:io.vavr.collection.HashSet
类名称:HashSet
方法名:add

HashSet.add介绍

暂无

代码示例

代码示例来源:origin: vavr-io/vavr

/**
 * Returns a singleton {@code HashSet}, i.e. a {@code HashSet} of one element.
 *
 * @param element An element.
 * @param <T>     The component type
 * @return A new HashSet instance containing the given element
 */
public static <T> HashSet<T> of(T element) {
  return HashSet.<T> empty().add(element);
}

代码示例来源:origin: vavr-io/vavr

@Override
public HashSet<T> replace(T currentElement, T newElement) {
  if (tree.containsKey(currentElement)) {
    return remove(currentElement).add(newElement);
  } else {
    return this;
  }
}

代码示例来源:origin: io.vavr/vavr

/**
 * Returns a singleton {@code HashSet}, i.e. a {@code HashSet} of one element.
 *
 * @param element An element.
 * @param <T>     The component type
 * @return A new HashSet instance containing the given element
 */
public static <T> HashSet<T> of(T element) {
  return HashSet.<T> empty().add(element);
}

代码示例来源:origin: io.vavr/vavr

@Override
public HashSet<T> replace(T currentElement, T newElement) {
  if (tree.containsKey(currentElement)) {
    return remove(currentElement).add(newElement);
  } else {
    return this;
  }
}

代码示例来源:origin: BNYMellon/CodeKatas

public Tuple2<Set<Card>, ? extends List<Card>> deal(List<Card> stack, int count)
{
  var hand = HashSet.<Card>empty();
  for (int i = 0; i < count; i++)
  {
    var cardTuple2 = stack.pop2();
    stack = cardTuple2._2();
    hand = hand.add(cardTuple2._1());
  }
  return Tuple.of(hand, stack);
}

相关文章