本文整理了Java中io.vavr.collection.Map.size()
方法的一些代码示例,展示了Map.size()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Map.size()
方法的具体详情如下:
包路径:io.vavr.collection.Map
类名称:Map
方法名:size
暂无
代码示例来源:origin: vavr-io/vavr
@Override
default int length() {
return size();
}
代码示例来源:origin: vavr-io/vavr
@SuppressWarnings("unchecked")
static <K, V> boolean equals(Map<K, V> source, Object object) {
if (source == object) {
return true;
} else if (source != null && object instanceof Map) {
final Map<K, V> map = (Map<K, V>) object;
if (source.size() != map.size()) {
return false;
} else {
try {
return source.forAll(map::contains);
} catch (ClassCastException e) {
return false;
}
}
} else {
return false;
}
}
代码示例来源:origin: vavr-io/vavr
static <K, V, M extends Map<K, V>> M takeWhile(M map, OfEntries<K, V, M> ofEntries,
Predicate<? super Tuple2<K, V>> predicate) {
Objects.requireNonNull(predicate, "predicate is null");
final M taken = ofEntries.apply(map.iterator().takeWhile(predicate));
return taken.size() == map.size() ? map : taken;
}
代码示例来源:origin: vavr-io/vavr
static <K, V, M extends Map<K, V>> M dropRight(M map, OfEntries<K, V, M> ofEntries, Supplier<M> emptySupplier,
int n) {
if (n <= 0) {
return map;
} else if (n >= map.size()) {
return emptySupplier.get();
} else {
return ofEntries.apply(map.iterator().dropRight(n));
}
}
代码示例来源:origin: vavr-io/vavr
static <K, V, M extends Map<K, V>> M drop(M map, OfEntries<K, V, M> ofEntries, Supplier<M> emptySupplier, int n) {
if (n <= 0) {
return map;
} else if (n >= map.size()) {
return emptySupplier.get();
} else {
return ofEntries.apply(map.iterator().drop(n));
}
}
代码示例来源:origin: vavr-io/vavr
static <K, V, M extends Map<K, V>> M take(M map, OfEntries<K, V, M> ofEntries, int n) {
if (n >= map.size()) {
return map;
} else {
return ofEntries.apply(map.iterator().take(n));
}
}
代码示例来源:origin: vavr-io/vavr
static <K, V, M extends Map<K, V>> M takeRight(M map, OfEntries<K, V, M> ofEntries, int n) {
if (n >= map.size()) {
return map;
} else {
return ofEntries.apply(map.iterator().takeRight(n));
}
}
代码示例来源:origin: io.vavr/vavr
@Override
default int length() {
return size();
}
代码示例来源:origin: io.vavr/vavr
@SuppressWarnings("unchecked")
static <K, V> boolean equals(Map<K, V> source, Object object) {
if (source == object) {
return true;
} else if (source != null && object instanceof Map) {
final Map<K, V> map = (Map<K, V>) object;
if (source.size() != map.size()) {
return false;
} else {
try {
return source.forAll(map::contains);
} catch (ClassCastException e) {
return false;
}
}
} else {
return false;
}
}
代码示例来源:origin: io.vavr/vavr
static <K, V, M extends Map<K, V>> M takeWhile(M map, OfEntries<K, V, M> ofEntries,
Predicate<? super Tuple2<K, V>> predicate) {
Objects.requireNonNull(predicate, "predicate is null");
final M taken = ofEntries.apply(map.iterator().takeWhile(predicate));
return taken.size() == map.size() ? map : taken;
}
代码示例来源:origin: io.vavr/vavr
static <K, V, M extends Map<K, V>> M drop(M map, OfEntries<K, V, M> ofEntries, Supplier<M> emptySupplier, int n) {
if (n <= 0) {
return map;
} else if (n >= map.size()) {
return emptySupplier.get();
} else {
return ofEntries.apply(map.iterator().drop(n));
}
}
代码示例来源:origin: io.vavr/vavr
static <K, V, M extends Map<K, V>> M dropRight(M map, OfEntries<K, V, M> ofEntries, Supplier<M> emptySupplier,
int n) {
if (n <= 0) {
return map;
} else if (n >= map.size()) {
return emptySupplier.get();
} else {
return ofEntries.apply(map.iterator().dropRight(n));
}
}
代码示例来源:origin: io.vavr/vavr
static <K, V, M extends Map<K, V>> M takeRight(M map, OfEntries<K, V, M> ofEntries, int n) {
if (n >= map.size()) {
return map;
} else {
return ofEntries.apply(map.iterator().takeRight(n));
}
}
代码示例来源:origin: nikhilnanivadekar/CollectionsCompare
@Benchmark
public int groupByJavaslangImmutable(Deck deck)
{
return deck.javaslangDeckOfCardsAsImmutableList.getCards().groupBy(Card::getSuit).size();
}
}
代码示例来源:origin: nikhilnanivadekar/CollectionsCompare
@Benchmark
public int groupByJavaslang(Deck deck)
{
return deck.javaslangDeckOfCards.getCards().groupBy(Card::getSuit).size();
}
代码示例来源:origin: io.vavr/vavr
static <K, V, M extends Map<K, V>> M take(M map, OfEntries<K, V, M> ofEntries, int n) {
if (n >= map.size()) {
return map;
} else {
return ofEntries.apply(map.iterator().take(n));
}
}
代码示例来源:origin: netzwerg/paleo
private static void assertMetaDataParsedCorrectly(DataFrame df) {
Map<String, String> dataFrameMetaData = df.getMetaData();
assertEquals(1, dataFrameMetaData.size());
assertEquals(Option.of("netzwerg"), dataFrameMetaData.get("author"));
Map<String, String> columnMetaData = df.getColumn(df.getColumnId(2, ColumnType.DOUBLE)).getMetaData();
assertEquals(1, columnMetaData.size());
assertEquals(Option.of("m"), columnMetaData.get("unit"));
}
内容来源于网络,如有侵权,请联系作者删除!