View Javadoc
1   /*
2   
3       dsh-multi-map  Multi-key map interfaces and implementation.
4       Copyright (c) 2007-2016 held jointly by the individual authors.
5   
6       This library is free software; you can redistribute it and/or modify it
7       under the terms of the GNU Lesser General Public License as published
8       by the Free Software Foundation; either version 3 of the License, or (at
9       your option) any later version.
10  
11      This library is distributed in the hope that it will be useful, but WITHOUT
12      ANY WARRANTY; with out even the implied warranty of MERCHANTABILITY or
13      FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
14      License for more details.
15  
16      You should have received a copy of the GNU Lesser General Public License
17      along with this library;  if not, write to the Free Software Foundation,
18      Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA.
19  
20      > http://www.fsf.org/licensing/licenses/lgpl.html
21      > http://www.opensource.org/licenses/lgpl-license.php
22  
23  */
24  package org.dishevelled.multimap.impl;
25  
26  import org.dishevelled.multimap.QuaternaryKeyMap;
27  
28  /**
29   * Static utility methods for QuaternaryKeyMaps.
30   *
31   * @author  Michael Heuer
32   */
33  public final class QuaternaryKeyMaps
34  {
35  
36      /**
37       * Private no-arg constructor.
38       */
39      private QuaternaryKeyMaps()
40      {
41          // empty
42      }
43  
44  
45      /**
46       * Create and return a new instance of QuaternaryKeyMap.
47       *
48       * @param <K1> first key type
49       * @param <K2> second key type
50       * @param <K3> third key type
51       * @param <K4> fourth key type
52       * @param <V> value type
53       * @return a new instance of QuaternaryKeyMap
54       */
55      public static <K1, K2, K3, K4, V> QuaternaryKeyMap<K1, K2, K3, K4, V> createQuaternaryKeyMap()
56      {
57          return new HashedQuaternaryKeyMap<K1, K2, K3, K4, V>();
58      }
59  
60      /**
61       * Create and return a new instance of QuaternaryKeyMap with the specified initial capacity.
62       *
63       * @param <K1> first key type
64       * @param <K2> second key type
65       * @param <K3> third key type
66       * @param <K4> fourth key type
67       * @param <V> value type
68       * @param initialCapacity initial capacity
69       * @return a new instance of QuaternaryKeyMap with the specified initial capacity
70       */
71      public static <K1, K2, K3, K4, V> QuaternaryKeyMap<K1, K2, K3, K4, V> createQuaternaryKeyMap(final int initialCapacity)
72      {
73          return new HashedQuaternaryKeyMap<K1, K2, K3, K4, V>(initialCapacity,
74                                                   HashedQuaternaryKeyMap.DEFAULT_LOAD_FACTOR,
75                                                   HashedQuaternaryKeyMap.DEFAULT_THRESHOLD);
76      }
77  
78      /**
79       * Create and return a new instance of QuaternaryKeyMap with the specified initial capacity,
80       * load factor, and threshold.
81       *
82       * @param <K1> first key type
83       * @param <K2> second key type
84       * @param <K3> third key type
85       * @param <K4> fourth key type
86       * @param <V> value type
87       * @param initialCapacity initial capacity
88       * @param loadFactor load factor
89       * @param threshold threshold
90       * @return a new instance of QuaternaryKeyMap with the specified initial capacity,
91       *    load factor, and threshold
92       */
93      public static <K1, K2, K3, K4, V> QuaternaryKeyMap<K1, K2, K3, K4, V> createQuaternaryKeyMap(final int initialCapacity,
94                                                                           final float loadFactor,
95                                                                           final int threshold)
96      {
97          return new HashedQuaternaryKeyMap<K1, K2, K3, K4, V>(initialCapacity, loadFactor, threshold);
98      }
99  }