private void sort() { Collections.sort( array_, new Comparator /*<RubyValue>*/() { public int compare(Object /*RubyValue*/ arg0, Object /*RubyValue*/ arg1) { RubyValue v = RubyAPI.callPublicOneArgMethod( (RubyValue) arg0, (RubyValue) arg1, null, RubyID.unequalID); return ((RubyFixnum) v).toInt(); } }); }
private void sort_with_block(final RubyBlock block) { final RubyArray self = this; Collections.sort( array_, new Comparator /*<RubyValue>*/() { public int compare(Object /*RubyValue*/ arg0, Object /*RubyValue*/ arg1) { // TODO can not check if block return/break occured. RubyValue v = block.invoke(self, (RubyValue) arg0, (RubyValue) arg1); return ((RubyFixnum) v).toInt(); } }); }
// @RubyLevelMethod(name="reverse!") public RubyArray reverseBang() { Collections.reverse(array_); return this; }
// @RubyLevelMethod(name="reverse") public RubyArray reverse() { RubyArray array = this.copy(); Collections.reverse(array.array_); return array; }