public override Object[] toArray <Object>(Object[] array) { Object[] result = array; if (array.Length > 0) { // we must create a new array to handle multi-threaded situations // where another thread could access data before we decorate it //result = (Object[]) Array.newInstance(array.getClass().getComponentType(), 0); result = new Object[array.Length]; } Object [] input = collection.toArray(result); for (int i = 0; i < result.Length; i++) { java.util.MapNS.Entry <object, object> makeUnmodifiable = (java.util.MapNS.Entry <object, object>)input[i]; UnmodifiableEntry ue = new UnmodifiableEntry(makeUnmodifiable); result[i] = ((Object)(object)ue); } // check to see if result should be returned straight if (result.Length > array.Length) { return(result); } // copy back into input array to fulfil the method contract java.lang.SystemJ.arraycopy(result, 0, array, 0, result.Length); if (array.Length > result.Length) { array[result.Length] = default(Object); } return(array); }
public override Object[] toArray() { Object[] array = collection.toArray(); for (int i = 0; i < array.Length; i++) { array[i] = new UnmodifiableEntry((java.util.MapNS.Entry <Object, Object>)array[i]); } return(array); }