org.jruby.RubyHash.iteratorExit()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.0k)|赞(0)|评价(0)|浏览(62)

本文整理了Java中org.jruby.RubyHash.iteratorExit方法的一些代码示例,展示了RubyHash.iteratorExit的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RubyHash.iteratorExit方法的具体详情如下:
包路径:org.jruby.RubyHash
类名称:RubyHash
方法名:iteratorExit

RubyHash.iteratorExit介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-complete

private <T> void iteratorVisitAll(ThreadContext context, VisitorWithState<T> visitor, T state) {
  try {
    iteratorEntry();
    visitAll(context, visitor, state);
  } finally {
    iteratorExit();
  }
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private void iteratorVisitAll(Visitor visitor) {
  try {
    iteratorEntry();
    visitAll(visitor);
  } finally {
    iteratorExit();
  }
}

代码示例来源:origin: org.jruby/jruby-core

private <T> void iteratorVisitAll(ThreadContext context, VisitorWithState<T> visitor, T state) {
  try {
    iteratorEntry();
    visitAll(context, visitor, state);
  } finally {
    iteratorExit();
  }
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private void iteratorVisitAll(Visitor visitor) {
  try {
    iteratorEntry();
    visitAll(visitor);
  } finally {
    iteratorExit();
  }
}

代码示例来源:origin: org.jruby/jruby-complete

private IRubyObject any_p_i_fast(ThreadContext context, Block block) {
  iteratorEntry();
  try {
    for (RubyHashEntry entry = head.nextAdded; entry != head; entry = entry.nextAdded) {
      if (block.yieldArray(context, context.runtime.newArray(entry.key, entry.value), null).isTrue())
        return context.tru;
    }
    return context.fals;
  } finally {
    iteratorExit();
  }
}

代码示例来源:origin: org.jruby/jruby-core

private IRubyObject any_p_i_fast(ThreadContext context, Block block) {
  iteratorEntry();
  try {
    for (RubyHashEntry entry = head.nextAdded; entry != head; entry = entry.nextAdded) {
      if (block.yieldArray(context, context.runtime.newArray(entry.key, entry.value), null).isTrue())
        return context.tru;
    }
    return context.fals;
  } finally {
    iteratorExit();
  }
}

代码示例来源:origin: org.jruby/jruby-complete

private IRubyObject any_p_i(ThreadContext context, Block block) {
  iteratorEntry();
  try {
    for (RubyHashEntry entry = head.nextAdded; entry != head; entry = entry.nextAdded) {
      IRubyObject newAssoc = RubyArray.newArray(context.runtime, entry.key, entry.value);
      if (block.yield(context, newAssoc).isTrue())
        return context.tru;
    }
    return context.fals;
  } finally {
    iteratorExit();
  }
}

代码示例来源:origin: org.jruby/jruby-complete

private IRubyObject any_p_p(ThreadContext context, IRubyObject pattern) {
  iteratorEntry();
  try {
    for (RubyHashEntry entry = head.nextAdded; entry != head; entry = entry.nextAdded) {
      IRubyObject newAssoc = RubyArray.newArray(context.runtime, entry.key, entry.value);
      if (pattern.callMethod(context, "===", newAssoc).isTrue())
        return context.tru;
    }
    return context.fals;
  } finally {
    iteratorExit();
  }
}

代码示例来源:origin: org.jruby/jruby-core

private IRubyObject any_p_p(ThreadContext context, IRubyObject pattern) {
  iteratorEntry();
  try {
    for (RubyHashEntry entry = head.nextAdded; entry != head; entry = entry.nextAdded) {
      IRubyObject newAssoc = RubyArray.newArray(context.runtime, entry.key, entry.value);
      if (pattern.callMethod(context, "===", newAssoc).isTrue())
        return context.tru;
    }
    return context.fals;
  } finally {
    iteratorExit();
  }
}

代码示例来源:origin: org.jruby/jruby-core

private IRubyObject any_p_i(ThreadContext context, Block block) {
  iteratorEntry();
  try {
    for (RubyHashEntry entry = head.nextAdded; entry != head; entry = entry.nextAdded) {
      IRubyObject newAssoc = RubyArray.newArray(context.runtime, entry.key, entry.value);
      if (block.yield(context, newAssoc).isTrue())
        return context.tru;
    }
    return context.fals;
  } finally {
    iteratorExit();
  }
}

代码示例来源:origin: org.jruby/jruby-complete

@JRubyMethod(name = "compact!")
public IRubyObject compact_bang(ThreadContext context) {
 boolean changed = false;
 modify();
 iteratorEntry();
 try {
  for (RubyHashEntry entry = head.nextAdded; entry != head; entry = entry.nextAdded) {
   if (entry.value == context.nil) {
    internalDelete(entry.key);
    changed = true;
   }
  }
 } finally {
  iteratorExit();
 }
 return changed ? this : context.nil;
}

代码示例来源:origin: org.jruby/jruby-core

@JRubyMethod(name = "compact!")
public IRubyObject compact_bang(ThreadContext context) {
 boolean changed = false;
 modify();
 iteratorEntry();
 try {
  for (RubyHashEntry entry = head.nextAdded; entry != head; entry = entry.nextAdded) {
   if (entry.value == context.nil) {
    internalDelete(entry.key);
    changed = true;
   }
  }
 } finally {
  iteratorExit();
 }
 return changed ? this : context.nil;
}

相关文章

微信公众号

最新文章

更多

RubyHash类方法