private RubyHash makeHash(RubyHash hash) { for (int i = 0; i < realLength; i++) { hash.fastASet(elt(i), NEVER); } return hash; }
private RubyHash makeHash(RubyHash hash) { for (int i = 0; i < realLength; i++) { hash.fastASet(elt(i), NEVER); } return hash; }
private RubyHash makeHash(ThreadContext context, RubyHash hash, Block block) { for (int i = 0; i < realLength; i++) { IRubyObject v = elt(i); IRubyObject k = block.yield(context, v); if (hash.fastARef(k) == null) hash.fastASet(k, v); } return hash; }
private RubyHash makeHash(ThreadContext context, RubyHash hash, Block block) { int myBegin = this.begin; for (int i = myBegin; i < myBegin + realLength; i++) { IRubyObject v = elt(i); IRubyObject k = block.yield(context, v); if (hash.fastARef(k) == null) hash.fastASet(k, v); } return hash; }
private RubyHash makeHash(ThreadContext context, RubyHash hash, Block block) { for (int i = 0; i < realLength; i++) { IRubyObject v = elt(i); IRubyObject k = block.yield(context, v); if (hash.fastARef(k) == null) hash.fastASet(k, v); } return hash; }
public Object set(int index, Object element) { Object previous = elt(index).toJava(Object.class); store(index, JavaUtil.convertJavaToUsableRubyObject(getRuntime(), element)); return previous; }
public Object set(int index, Object element) { Object previous = elt(index).toJava(Object.class); store(index, JavaUtil.convertJavaToUsableRubyObject(getRuntime(), element)); return previous; }
public Object set(int index, Object element) { Object previous = elt(index).toJava(Object.class); store(index, JavaUtil.convertJavaToUsableRubyObject(getRuntime(), element)); return previous; }
public Object set(int index, Object element) { Object previous = elt(index).toJava(Object.class); store(index, JavaUtil.convertJavaToUsableRubyObject(getRuntime(), element)); return previous; }
@JRubyMethod(name = "count") public IRubyObject count(ThreadContext context, IRubyObject obj, Block block) { if (block.isGiven()) context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); int n = 0; for (int i = 0; i < realLength; i++) { if (equalInternal(context, elt(i), obj)) n++; } return RubyFixnum.newFixnum(context.runtime, n); }
@JRubyMethod(name = "count") public IRubyObject count(ThreadContext context, Block block) { if (block.isGiven()) { int n = 0; for (int i = 0; i < realLength; i++) { if (block.yield(context, elt(i)).isTrue()) n++; } return RubyFixnum.newFixnum(context.runtime, n); } else { return RubyFixnum.newFixnum(context.runtime, realLength); } }
@JRubyMethod(name = "count") public IRubyObject count(ThreadContext context, IRubyObject obj, Block block) { if (block.isGiven()) context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); int n = 0; for (int i = 0; i < realLength; i++) { if (equalInternal(context, elt(i), obj)) n++; } return RubyFixnum.newFixnum(context.runtime, n); }
@JRubyMethod(name = "count") public IRubyObject count(ThreadContext context, Block block) { if (block.isGiven()) { int n = 0; for (int i = 0; i < realLength; i++) { if (block.yield(context, elt(i)).isTrue()) n++; } return RubyFixnum.newFixnum(context.runtime, n); } else { return RubyFixnum.newFixnum(context.runtime, realLength); } }
@JRubyMethod(name = "count") public IRubyObject count(ThreadContext context, Block block) { if (block.isGiven()) { int n = 0; for (int i = 0; i < realLength; i++) { if (block.yield(context, elt(i)).isTrue()) n++; } return RubyFixnum.newFixnum(context.runtime, n); } else { return RubyFixnum.newFixnum(context.runtime, realLength); } }
@JRubyMethod(name = "count") public IRubyObject count(ThreadContext context, IRubyObject obj, Block block) { if (block.isGiven()) context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); int n = 0; for (int i = 0; i < realLength; i++) { if (equalInternal(context, elt(i), obj)) n++; } return RubyFixnum.newFixnum(context.runtime, n); }
@JRubyMethod(name = "count") public IRubyObject count(ThreadContext context, Block block) { if (block.isGiven()) { int n = 0; for (int i = 0; i < realLength; i++) { if (block.yield(context, elt(i)).isTrue()) n++; } return RubyFixnum.newFixnum(context.runtime, n); } else { return RubyFixnum.newFixnum(context.runtime, realLength); } }
@JRubyMethod(name = "count") public IRubyObject count(ThreadContext context, IRubyObject obj, Block block) { if (block.isGiven()) context.runtime.getWarnings().warn(ID.BLOCK_UNUSED, "given block not used"); int n = 0; for (int i = 0; i < realLength; i++) { if (equalInternal(context, elt(i), obj)) n++; } return RubyFixnum.newFixnum(context.runtime, n); }