当前位置: 首页>>代码示例>>Java>>正文


Java TIntHashSet.forEach方法代码示例

本文整理汇总了Java中gnu.trove.TIntHashSet.forEach方法的典型用法代码示例。如果您正苦于以下问题:Java TIntHashSet.forEach方法的具体用法?Java TIntHashSet.forEach怎么用?Java TIntHashSet.forEach使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gnu.trove.TIntHashSet的用法示例。


在下文中一共展示了TIntHashSet.forEach方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getReachable

import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
private static LinkedHashSet<Integer> getReachable(final LinkedHashSet<Integer> fragmentInsns, final Instruction[] flow, TIntObjectHashMap<TIntHashSet> dfaResult, final int[] postorder) {
  final LinkedHashSet<Integer> result = new LinkedHashSet<Integer>();
  for (Instruction insn : flow) {
    if (insn instanceof ReadWriteVariableInstruction &&
        !((ReadWriteVariableInstruction) insn).isWrite()) {
      final int ref = insn.num();
      TIntHashSet defs = dfaResult.get(ref);
      defs.forEach(new TIntProcedure() {
        public boolean execute(int def) {
          if (fragmentInsns.contains(def)) {
            if (!fragmentInsns.contains(ref) || postorder[ref] < postorder[def]) {
              result.add(ref);
              return false;
            }
          }
          return true;
        }
      });
    }
  }

  return result;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:24,代码来源:ReachingDefinitionsCollector.java

示例2: save

import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
public static <X> void save(final TIntHashSet x, final DataOutput out) {
  try {
    DataInputOutputUtil.writeINT(out, x.size());
    x.forEach(new TIntProcedure() {
      @Override
      public boolean execute(int value) {
        try {
          DataInputOutputUtil.writeINT(out, value);
          return true;
        }
        catch (IOException e) {
          throw new BuildDataCorruptedException(e);
        }
      }
    });
  }
  catch (IOException c) {
    throw new BuildDataCorruptedException(c);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:RW.java

示例3: save

import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
@Override
public void save(@NotNull final DataOutput out, final TIntHashSet value) throws IOException {
  final Ref<IOException> exRef = new Ref<IOException>(null);
  value.forEach(new TIntProcedure() {
    @Override
    public boolean execute(int elem) {
      try {
        DataInputOutputUtil.writeINT(out, elem);
      }
      catch (IOException e) {
        exRef.set(e);
        return false;
      }
      return true;
    }
  });
  final IOException exception = exRef.get();
  if (exception != null) {
    throw exception;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:IntIntPersistentMultiMaplet.java

示例4: removeAll

import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
@Override
public void removeAll(int key, TIntHashSet values) {
  final TIntHashSet collection = myMap.get(key);
  if (collection != null) {
    values.forEach(new TIntProcedure() {
      @Override
      public boolean execute(int value) {
        collection.remove(value);
        return true;
      }
    });
    if (collection.isEmpty()) {
      myMap.remove(key);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:IntIntTransientMultiMaplet.java

示例5: testTrailingSoftWrapOffsetShiftOnTyping

import gnu.trove.TIntHashSet; //导入方法依赖的package包/类
public void testTrailingSoftWrapOffsetShiftOnTyping() throws IOException {
  // The main idea is to type on a logical line before soft wrap in order to ensure that its offset is correctly shifted back.
  String text = 
    "line1<caret>\n" +
    "second line that is long enough to be soft wrapped";
  init(15, text);

  TIntHashSet offsetsBefore = collectSoftWrapStartOffsets(1);
  assertTrue(!offsetsBefore.isEmpty());
  
  type('2');
  final TIntHashSet offsetsAfter = collectSoftWrapStartOffsets(1);
  assertSame(offsetsBefore.size(), offsetsAfter.size());
  offsetsBefore.forEach(new TIntProcedure() {
    @Override
    public boolean execute(int value) {
      assertTrue(offsetsAfter.contains(value + 1));
      return true;
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:SoftWrapApplianceOnDocumentModificationTest.java


注:本文中的gnu.trove.TIntHashSet.forEach方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。