Example usage for org.apache.commons.math4.util Pair Pair

List of usage examples for org.apache.commons.math4.util Pair Pair

Introduction

In this page you can find the example usage for org.apache.commons.math4.util Pair Pair.

Prototype

public Pair(K k, V v) 

Source Link

Document

Create an entry representing a mapping from the specified key to the specified value.

Usage

From source file:delfos.rs.contentbased.vsm.booleanvsm.SparseVector.java

public List<Pair<Key, Double>> entrySet() {
    return map.entrySet().stream().sorted((entry1, entry2) -> entry1.getKey().compareTo(entry2.getKey()))
            .map(entry -> new Pair<>(entry.getKey(), entry.getValue())).collect(Collectors.toList());
}

From source file:delfos.dataset.util.DatasetPrinter.java

public static String printCompactRatingTableSortedByNumRatings(DatasetLoader<? extends Rating> datasetLoader,
        Collection<User> _users) {

    final List<User> users = _users.stream().sorted(User.BY_ID).collect(Collectors.toList());
    final List<Item> itemsAllUsersRated = datasetLoader.getContentDataset().stream().sorted(Item.BY_ID)
            .map(item -> {//www.  j av a 2 s. c  om
                List<User> listOfUsersThatRated = datasetLoader.getRatingsDataset()
                        .getItemRatingsRated(item.getId()).values().stream().filter(rating -> {
                            return _users.contains(rating.getUser());
                        }).map(rating -> rating.getUser()).collect(Collectors.toList());
                GroupOfUsers groupOfUsersThatRated = new GroupOfUsers(listOfUsersThatRated);
                return new Pair<GroupOfUsers, Item>(groupOfUsersThatRated, item);
            }).filter(pair -> !pair.getKey().isEmpty())
            .sorted((pair1, pair2) -> -pair1.getKey().compareTo(pair2.getKey())).map(pair -> pair.getValue())
            .collect(Collectors.toList());

    return actuallyDoTheTable(itemsAllUsersRated, users, datasetLoader);
}