KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > bak > pcj > map > MapDefaults


1 /*
2  * Primitive Collections for Java.
3  * Copyright (C) 2002 Søren Bak
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2.1 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public
16  * License along with this library; if not, write to the Free Software
17  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18  */

19 package bak.pcj.map;
20
21 /**
22  * This class implements methods for retrieving default values for
23  * each of the primitive types. The default values are returned by
24  * the maps' <tt>get()</tt>-methods when a specified key does not
25  * map to any value.
26  *
27  * <p>Note: Later versions may provide the ability to configure
28  * the default values returned by maps.
29  *
30  * @author S&oslash;ren Bak
31  * @version 1.0 2002/29/12
32  * @since 1.0
33  */

34 public class MapDefaults {
35
36     /**
37      * Returns a default boolean value (<tt>false</tt>).
38      *
39      * @return a default boolean value (<tt>false</tt>).
40      */

41     public static boolean defaultBoolean()
42     { return false; }
43
44     /**
45      * Returns a default char value (<tt>'\0'</tt>).
46      *
47      * @return a default char value (<tt>'\0'</tt>).
48      */

49     public static char defaultChar()
50     { return '\0'; }
51
52     /**
53      * Returns a default byte value (<tt>0</tt>).
54      *
55      * @return a default byte value (<tt>0</tt>).
56      */

57     public static byte defaultByte()
58     { return 0; }
59
60     /**
61      * Returns a default short value (<tt>0</tt>).
62      *
63      * @return a default short value (<tt>0</tt>).
64      */

65     public static short defaultShort()
66     { return 0; }
67
68     /**
69      * Returns a default int value (<tt>0</tt>).
70      *
71      * @return a default int value (<tt>0</tt>).
72      */

73     public static int defaultInt()
74     { return 0; }
75
76     /**
77      * Returns a default long value (<tt>0L</tt>).
78      *
79      * @return a default long value (<tt>0L</tt>).
80      */

81     public static long defaultLong()
82     { return 0; }
83
84     /**
85      * Returns a default float value (<tt>0.0f</tt>).
86      *
87      * @return a default float value (<tt>0.0f</tt>).
88      */

89     public static float defaultFloat()
90     { return 0.0f; }
91
92     /**
93      * Returns a default double value (<tt>0.0</tt>).
94      *
95      * @return a default double value (<tt>0.0</tt>).
96      */

97     public static double defaultDouble()
98     { return 0.0; }
99
100 }
Popular Tags