multikeymapjava

Java 8 implementation of the multi-key map. It behaves like a regular generic Map with the additional ability of getting its values by any combination of partial keys.

Лицензия

Лицензия

Категории

Категории

Protobuf Данные Data Structures KeY Data Formats Formal Verification
Группа

Группа

com.github.protobufel
Идентификатор

Идентификатор

multikeymapjava
Последняя версия

Последняя версия

0.7.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

multikeymapjava
Java 8 implementation of the multi-key map. It behaves like a regular generic Map with the additional ability of getting its values by any combination of partial keys.
Ссылка на сайт

Ссылка на сайт

https://github.com/protobufel/multikeymapjava
Система контроля версий

Система контроля версий

https://github.com/protobufel/multikeymapjava

Скачать multikeymapjava

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.github.protobufel/multikeymapjava/ -->
<dependency>
    <groupId>com.github.protobufel</groupId>
    <artifactId>multikeymapjava</artifactId>
    <version>0.7.0</version>
</dependency>
// https://jarcasting.com/artifacts/com.github.protobufel/multikeymapjava/
implementation 'com.github.protobufel:multikeymapjava:0.7.0'
// https://jarcasting.com/artifacts/com.github.protobufel/multikeymapjava/
implementation ("com.github.protobufel:multikeymapjava:0.7.0")
'com.github.protobufel:multikeymapjava:jar:0.7.0'
<dependency org="com.github.protobufel" name="multikeymapjava" rev="0.7.0">
  <artifact name="multikeymapjava" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.github.protobufel', module='multikeymapjava', version='0.7.0')
)
libraryDependencies += "com.github.protobufel" % "multikeymapjava" % "0.7.0"
[com.github.protobufel/multikeymapjava "0.7.0"]

Зависимости

test (5)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
org.assertj : assertj-core jar 3.8.0
com.google.guava : guava jar 22.0
com.google.guava : guava-testlib jar 22.0
pl.pragmatists : JUnitParams jar 1.1.0

Модули Проекта

Данный проект не имеет модулей.

Travis branch codecov Maven Central

MultiKeyMap Java Implementation

Java 8 implementation of the multi-key map. It behaves like a regular generic Map with the additional ability of getting its values by any combination of partial keys. For example, one can add any value with the complex key {"Hello", "the", "wonderful", "World!"} , and then query by any sequence of subkeys like {"wonderful", "Hello"}. In addition, you can query by a mixture of some any-position-sub-keys and positional sub-keys, as in the following example:

    MultiKeyMap<String, Iterable<String>, String> map = MultiKeyMaps.newMultiKeyMap();

    // add a record
    map.put(Arrays.asList("Hello", ",", "the", "wonderful", "world"), "You found me!");

    // or copy some data from the compatible Map
    Map<Iterable<String>, String> dict = new HashMap<>();
    dict.put(Arrays.asList("okay", "I", "am", "here"), "or there!");
    dict.put(Arrays.asList("okay", "I", "am", "not", "here"), "for sure!");

    // adding the data from another Map or MultiKeyMap
    map.putAll(dict);

    // MultiKeyMap interface extends Map, and also adds get{FullKeys|Values|Entries}ByPartialKey
    // methods of its own
    String exactMatch = map.get(Arrays.asList("okay", "I", "am", "here"));

    if (exactMatch != null) {
      System.out.println(String.format(
          "This is a regular Map method, looking for exact full key. Let's see the actual value: %s",
          exactMatch));
    }

    // lets look by partial key anywhere within the full key (any sequence in any order of some
    // sub-keys of the original full key we're looking for)
    // should be 1 record with value = 'for sure!'. Let's see the actual one:
    map.getValuesByPartialKey(Arrays.asList("not", "I")).forEach(System.out::println);

    // lets look by partial key, wherein some sub-keys are looked at the particular 0-based
    // positions ( >= 0), and others anywhere ( < 0)
    // should be 1 record with value = 'or there!'. Let's see the actual one:
    map.getValuesByPartialKey(Arrays.asList("here", "I", "am"), Arrays.asList(3, -1, -1))
        .forEach(System.out::println);

    map.clear();
    // Happy using!

For more see the JavaDoc Documentation.

Happy coding,

David Tesler

Версии библиотеки

Версия
0.7.0
0.6.8
0.6.0
0.5.0
0.4.1