Example usage for java.util.concurrent ConcurrentSkipListMap values

List of usage examples for java.util.concurrent ConcurrentSkipListMap values

Introduction

In this page you can find the example usage for java.util.concurrent ConcurrentSkipListMap values.

Prototype

Values values

To view the source code for java.util.concurrent ConcurrentSkipListMap values.

Click Source Link

Document

Lazily initialized values collection

Usage

From source file:com.doctor.other.concurrent_hash_map_based_table.ConcurrentHashMapBasedTable.java

public List<T> get(final String rowKey, final String columnKey) {
    Preconditions.checkState(StringUtils.isNotBlank(rowKey), "rowKey is blank");
    Preconditions.checkState(StringUtils.isNotBlank(columnKey), "columnKey is blank");

    ConcurrentHashMap<String, ConcurrentSkipListMap<String, ConcurrentSet<T>>> row = table.get(rowKey);
    if (row == null) {
        return Arrays.asList();
    }//from   ww w.j ava 2  s  .  c o m

    ConcurrentSkipListMap<String, ConcurrentSet<T>> column = row.get(columnKey);
    if (column == null) {
        return Arrays.asList();
    }

    return column.values().parallelStream().flatMap(v -> v.parallelStream()).collect(Collectors.toList());
}

From source file:com.doctor.other.concurrent_hash_map_based_table.ConcurrentHashMapBasedTable.java

public Long getSumForRowColumnKey(final String rowKey, final String columnKey) {
    if (StringUtils.isBlank(rowKey) || StringUtils.isBlank(columnKey)) {
        return Long.valueOf(0L);
    }/*w ww . j  ava  2s . c o  m*/

    ConcurrentHashMap<String, ConcurrentSkipListMap<String, ConcurrentSet<T>>> row = table.get(rowKey);
    if (row == null) {
        return Long.valueOf(0L);
    }

    ConcurrentSkipListMap<String, ConcurrentSet<T>> column = row.get(columnKey);
    if (column == null) {
        return Long.valueOf(0L);
    }

    return column.values().parallelStream().mapToLong(k -> k.size()).sum();
}