We'll be wantin' the size as well.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@1053 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
//
|
//
|
||||||
// $Id: CheapIntMap.java,v 1.2 2003/02/06 20:00:05 mdb Exp $
|
// $Id: CheapIntMap.java,v 1.3 2003/02/06 20:02:14 mdb Exp $
|
||||||
|
|
||||||
package com.samskivert.util;
|
package com.samskivert.util;
|
||||||
|
|
||||||
@@ -95,6 +95,20 @@ public class CheapIntMap
|
|||||||
Arrays.fill(_values, null);
|
Arrays.fill(_values, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the number of mappings in this table.
|
||||||
|
*/
|
||||||
|
public int size ()
|
||||||
|
{
|
||||||
|
int size = 0;
|
||||||
|
for (int ii = 0, ll = _keys.length; ii < ll; ii++) {
|
||||||
|
if (_keys[ii] != -1) {
|
||||||
|
size++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return size;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the key with the specified index or -1 if no key exists at
|
* Returns the key with the specified index or -1 if no key exists at
|
||||||
* that index.
|
* that index.
|
||||||
|
|||||||
Reference in New Issue
Block a user