6135 links
  • GuiGui's Show
  • Home
  • Login
  • RSS Feed
  • ATOM Feed
  • Tag cloud
  • Picture wall
  • Daily
Links per page: 20 50 100
 
  • Apache Java Commons Collections
    Bien vu, les multimap (stocker plusieurs objets avec une même clé pour y accéder).

    MultiMap<Integer, String> testMM = new MultiValueMap<Integer,String>();
    testMM.put(1, "toto");
    testMM.put(1, "titi");
    testMM.put(2, "lala");
    System.out.println(testMM.get(1));=> [toto, titi]

    Évidemment, ça fonctionne avec n'importe quels objets en clés/valeurs.

    Pas mal aussi l'implémentation d'un arbre Radix (cf : http://shaarli.guiguishow.info/?GZW_8g). Mais attention : ce n'est pas prévu pour le stockage/recherche d'adresses/réseaux IP (car c'est de la comparaison bit-à-bit de string qui ne tient donc pas compte du masque). Contre-démo :
    PatriciaTrie<Integer> test = new PatriciaTrie<Integer>();
    test.put("0.0.0.0/0", 0);
    test.put("8.8.8.0/24", 15169);
    //test.put("89.234.141.0/24", 60630);
    System.out.println(test.select("89.234.141.141"));
    => Entry(key=8.8.8.0/24 [12], value=15169, parent=0.0.0.0/0 [10], left=0.0.0.0/0 [10], right=8.8.8.0/24 [12], predecessor=8.8.8.0/24 [12])

    ÉDIT DU 10/05/2015 : il existe aussi Guava, https://github.com/google/guava, anciennement Google Collections. Guava propose des TreeMultiMap donc il est possible de trier une Multimap, ce que ne propose pas MultiMap (l'implémentation de l'Apache Foundation). FIN DDE L'ÉDIT.
    April 15, 2015 at 5:42:38 PM UTC - permalink - https://commons.apache.org/proper/commons-collections/
Links per page: 20 50 100
 
Mentions légales identiques à celles de mon blog | CC BY-SA 3.0

Shaarli - The personal, minimalist, super fast, database-free, bookmarking service by the Shaarli community