Author: mcucchiara
Date: Tue Oct 25 14:53:43 2011
New Revision: 1188682
URL: http://svn.apache.org/viewvc?rev=1188682&view=rev
Log:
Fixed checkstyle warning (added magic numbers)
Modified:
commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/IntHashMap.java
Modified:
commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/IntHashMap.java
URL:
http://svn.apache.org/viewvc/commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/IntHashMap.java?rev=1188682&r1=1188681&r2=1188682&view=diff
==============================================================================
---
commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/IntHashMap.java
(original)
+++
commons/proper/ognl/trunk/src/main/java/org/apache/commons/ognl/IntHashMap.java
Tue Oct 25 14:53:43 2011
@@ -48,6 +48,13 @@ import java.util.Set;
public class IntHashMap<K extends Number, V>
implements Map<K, V>
{
+
+ private static final int DEFAULT_INITIAL_CAPACITY = 101;
+
+ private static final float DEFAULT_LOAD_FACTOR = 0.75f;
+
+ private static final int MASK = 0x7FFFFFFF;
+
private Entry table[];
private int count;
@@ -91,7 +98,8 @@ public class IntHashMap<K extends Number
}
while ( index-- > 0 )
{
- if ( ( entry = table[index] ) != null )
+ entry = table[index];
+ if ( entry != null )
{
return true;
}
@@ -198,12 +206,12 @@ public class IntHashMap<K extends Number
public IntHashMap( int initialCapacity )
{
- this( initialCapacity, 0.75f );
+ this( initialCapacity, DEFAULT_LOAD_FACTOR );
}
public IntHashMap()
{
- this( 101, 0.75f );
+ this( DEFAULT_INITIAL_CAPACITY, DEFAULT_LOAD_FACTOR );
}
/*
@@ -224,7 +232,7 @@ public class IntHashMap<K extends Number
for ( Entry old = oldTable[i]; old != null; )
{
Entry e = old;
- int index = ( e.getHash() & 0x7FFFFFFF ) % newCapacity;
+ int index = ( e.getHash() & MASK ) % newCapacity;
old = old.getNext();
e.setNext( newTable[index] );