Added toShortArray().

git-svn-id: https://samskivert.googlecode.com/svn/trunk@1061 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
mdb
2003-03-04 19:05:43 +00:00
parent 469f37d176
commit 3fed034271
@@ -1,5 +1,5 @@
//
// $Id: ArrayIntSet.java,v 1.11 2003/01/31 02:27:48 mdb Exp $
// $Id: ArrayIntSet.java,v 1.12 2003/03/04 19:05:43 mdb Exp $
//
// samskivert library - useful routines for java programs
// Copyright (C) 2001 Michael Bayne
@@ -131,6 +131,20 @@ public class ArrayIntSet extends AbstractSet
return target;
}
/**
* Creates an array of shorts from the contents of this set. Any
* values outside the range of a short will be truncated by way of a
* cast.
*/
public short[] toShortArray ()
{
short[] values = new short[_size];
for (int ii = 0; ii < _size; ii++) {
values[ii] = (short)_values[ii];
}
return values;
}
// documentation inherited from interface
public boolean add (Object o)
{