java.util.ConcurrentModificationException.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(9.8k)|赞(0)|评价(0)|浏览(101)

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

ConcurrentModificationException.<init>介绍

[英]Constructs a new ConcurrentModificationException with the current stack trace filled in.
[中]构造一个新的ConcurrentModificationException,并填充当前堆栈跟踪。

代码示例

代码示例来源:origin: com.koloboke/koloboke-impl-jdk8

@Override
public void forEachRemaining(Consumer<? super Double> action) {
  if (action == null)
    throw new java.lang.NullPointerException();
  long[] tab = this.tab;
  int nextI = nextIndex;
  for (int i = nextI; i >= 0; i -= 2) {
    if (tab[i] < FREE_BITS) {
      action.accept(Double.longBitsToDouble(tab[i + 1]));
    }
  }
  if (nextI != nextIndex) {
    throw new java.util.ConcurrentModificationException();
  }
  nextIndex = -1;
}

代码示例来源:origin: qcri/Arabesque

@Override
public void forEachForward(@Nonnull IntConsumer intConsumer) {
  int localNumElements = numElements;
  for (int i = index; i < localNumElements; ++i) {
    intConsumer.accept(backingArray[i]);
  }
  if(localNumElements != numElements) {
    throw new ConcurrentModificationException();
  } else {
    this.index = numElements;
  }
}

代码示例来源:origin: com.koloboke/koloboke-impl-jdk8

@Override
public void forEachRemaining(@Nonnull Consumer<? super Map.Entry<Double, Double>> action) {
  if (action == null)
    throw new java.lang.NullPointerException();
  long[] tab = this.tab;
  int nextI = nextIndex;
  for (int i = nextI; i >= 0; i -= 2) {
    long key;
    if ((key = tab[i]) < FREE_BITS) {
      action.accept(new ImmutableEntry(key, tab[i + 1]));
    }
  }
  if (nextI != nextIndex) {
    throw new java.util.ConcurrentModificationException();
  }
  nextIndex = -1;
}

代码示例来源:origin: net.openhft/koloboke-impl-jdk8

boolean removeAll(@Nonnull HashFloatSet thisC, @Nonnull Collection<?> c) {
  if (thisC == c)
    throw new IllegalArgumentException();
  if (isEmpty() || c.isEmpty())
    return false;
  boolean changed = false;
  int mc = modCount();
  long[] tab = table;
  long base = LONG_BASE + FLOAT_KEY_OFFSET;
  for (long off = ((long) tab.length) << LONG_SCALE_SHIFT; (off -= LONG_SCALE) >= 0L;) {
    int key;
    if ((key = U.getInt(tab, base + off)) < FREE_BITS) {
      if (c.contains(Float.intBitsToFloat(key))) {
        incrementModCount();
        mc++;
        U.putInt(tab, base + off, REMOVED_BITS);
        postRemoveHook();
        changed = true;
      }
    }
  }
  if (mc != modCount())
    throw new java.util.ConcurrentModificationException();
  return changed;
}

代码示例来源:origin: com.koloboke/koloboke-impl-jdk8

@Override
public boolean forEachWhile(@Nonnull  Predicate<? super Map.Entry<Double, Double>> predicate) {
  if (predicate == null)
    throw new java.lang.NullPointerException();
  if (this.isEmpty())
    return true;
  boolean terminated = false;
  int mc = modCount();
  long[] tab = table;
  for (int i = tab.length - 2; i >= 0; i -= 2) {
    long key;
    if ((key = tab[i]) < FREE_BITS) {
      if (!predicate.test(new MutableEntry(mc, i, key, tab[i + 1]))) {
        terminated = true;
        break;
      }
    }
  }
  if (mc != modCount())
    throw new java.util.ConcurrentModificationException();
  return !terminated;
}

代码示例来源:origin: com.koloboke/koloboke-impl-jdk8

boolean removeAll(@Nonnull HashFloatSet thisC, @Nonnull Collection<?> c) {
  if (thisC == (Object) c)
    throw new IllegalArgumentException();
  if (this.isEmpty() || c.isEmpty())
    return false;
  boolean changed = false;
  int mc = modCount();
  long[] tab = table;
  long base = LONG_BASE + FLOAT_KEY_OFFSET;
  for (long off = ((long) tab.length) << LONG_SCALE_SHIFT; (off -= LONG_SCALE) >= 0L;) {
    int key;
    if ((key = U.getInt(tab, base + off)) < FREE_BITS) {
      if (c.contains(Float.intBitsToFloat(key))) {
        incrementModCount();
        mc++;
        U.putInt(tab, base + off, REMOVED_BITS);
        postRemoveHook();
        changed = true;
      }
    }
  }
  if (mc != modCount())
    throw new java.util.ConcurrentModificationException();
  return changed;
}

代码示例来源:origin: net.openhft/koloboke-impl-jdk8

@Override
public void forEachRemaining(@Nonnull Consumer<? super Map.Entry<Double, Double>> action) {
  if (action == null)
    throw new java.lang.NullPointerException();
  long[] tab = this.tab;
  int nextI = nextIndex;
  for (int i = nextI; i >= 0; i -= 2) {
    long key;
    if ((key = tab[i]) < FREE_BITS) {
      action.accept(new ImmutableEntry(key, tab[i + 1]));
    }
  }
  if (nextI != nextIndex) {
    throw new java.util.ConcurrentModificationException();
  }
  nextIndex = -1;
}

代码示例来源:origin: net.openhft/koloboke-impl-jdk8

@Override
public boolean forEachWhile(@Nonnull  Predicate<? super Map.Entry<Double, Long>> predicate) {
  if (predicate == null)
    throw new java.lang.NullPointerException();
  if (isEmpty())
    return true;
  boolean terminated = false;
  int mc = modCount();
  long[] tab = table;
  for (int i = tab.length - 2; i >= 0; i -= 2) {
    long key;
    if ((key = tab[i]) < FREE_BITS) {
      if (!predicate.test(new MutableEntry(mc, i, key, tab[i + 1]))) {
        terminated = true;
        break;
      }
    }
  }
  if (mc != modCount())
    throw new java.util.ConcurrentModificationException();
  return !terminated;
}

代码示例来源:origin: net.openhft/koloboke-impl-jdk8

@Override
public void forEachRemaining(Consumer<? super Double> action) {
  if (action == null)
    throw new java.lang.NullPointerException();
  long[] tab = this.tab;
  int nextI = nextIndex;
  for (int i = nextI; i >= 0; i -= 2) {
    if (tab[i] < FREE_BITS) {
      action.accept(Double.longBitsToDouble(tab[i + 1]));
    }
  }
  if (nextI != nextIndex) {
    throw new java.util.ConcurrentModificationException();
  }
  nextIndex = -1;
}

代码示例来源:origin: qcri/Arabesque

@Override
public void forEachRemaining(@Nonnull IntConsumer intConsumer) {
  int localNumElements = numElements;
  for (int i = index + 1; i < localNumElements - 1; ++i) {
    intConsumer.accept(backingArray[i]);
  }
  if (localNumElements != numElements) {
    throw new ConcurrentModificationException();
  } else {
    index = numElements - 1;
  }
}

代码示例来源:origin: com.koloboke/koloboke-impl-jdk6-7

boolean removeAll(@Nonnull HashFloatSet thisC, @Nonnull Collection<?> c) {
  if (thisC == (Object) c)
    throw new IllegalArgumentException();
  if (this.isEmpty() || c.isEmpty())
    return false;
  boolean changed = false;
  int mc = modCount();
  long[] tab = table;
  long base = LONG_BASE + FLOAT_KEY_OFFSET;
  for (long off = ((long) tab.length) << LONG_SCALE_SHIFT; (off -= LONG_SCALE) >= 0L;) {
    int key;
    if ((key = U.getInt(tab, base + off)) < FREE_BITS) {
      if (c.contains(Float.intBitsToFloat(key))) {
        incrementModCount();
        mc++;
        U.putInt(tab, base + off, REMOVED_BITS);
        postRemoveHook();
        changed = true;
      }
    }
  }
  if (mc != modCount())
    throw new java.util.ConcurrentModificationException();
  return changed;
}

代码示例来源:origin: net.openhft/koloboke-impl-jdk8

@Override
public void forEachRemaining(@Nonnull Consumer<? super Map.Entry<Double, Long>> action) {
  if (action == null)
    throw new java.lang.NullPointerException();
  long[] tab = this.tab;
  int nextI = nextIndex;
  for (int i = nextI; i >= 0; i -= 2) {
    long key;
    if ((key = tab[i]) < FREE_BITS) {
      action.accept(new ImmutableEntry(key, tab[i + 1]));
    }
  }
  if (nextI != nextIndex) {
    throw new java.util.ConcurrentModificationException();
  }
  nextIndex = -1;
}

代码示例来源:origin: com.koloboke/koloboke-impl-jdk8

@Override
public boolean forEachWhile(@Nonnull  Predicate<? super Map.Entry<Double, Long>> predicate) {
  if (predicate == null)
    throw new java.lang.NullPointerException();
  if (this.isEmpty())
    return true;
  boolean terminated = false;
  int mc = modCount();
  long[] tab = table;
  for (int i = tab.length - 2; i >= 0; i -= 2) {
    long key;
    if ((key = tab[i]) < FREE_BITS) {
      if (!predicate.test(new MutableEntry(mc, i, key, tab[i + 1]))) {
        terminated = true;
        break;
      }
    }
  }
  if (mc != modCount())
    throw new java.util.ConcurrentModificationException();
  return !terminated;
}

代码示例来源:origin: com.koloboke/koloboke-impl-jdk8

@Override
public void forEach(Consumer<? super Double> action) {
  if (action == null)
    throw new java.lang.NullPointerException();
  if (this.isEmpty())
    return;
  int mc = modCount();
  long[] tab = table;
  for (int i = tab.length - 2; i >= 0; i -= 2) {
    if (tab[i] < FREE_BITS) {
      action.accept(Double.longBitsToDouble(tab[i + 1]));
    }
  }
  if (mc != modCount())
    throw new java.util.ConcurrentModificationException();
}

代码示例来源:origin: com.github.bloodshura/ignitium-core

@Nonnull
@Override
public synchronized final E previous() throws ConcurrentModificationException {
  if (!hasPrevious()) {
    throw new ConcurrentModificationException("No more elements (concurrency problem?)");
  }
  return get(--index);
}

代码示例来源:origin: net.openhft/koloboke-impl-jdk8

boolean removeAll(@Nonnull HashDoubleSet thisC, @Nonnull Collection<?> c) {
  if (thisC == c)
    throw new IllegalArgumentException();
  if (isEmpty() || c.isEmpty())
    return false;
  boolean changed = false;
  int mc = modCount();
  long[] tab = table;
  for (int i = tab.length - 2; i >= 0; i -= 2) {
    long key;
    if ((key = tab[i]) < FREE_BITS) {
      if (c.contains(Double.longBitsToDouble(key))) {
        incrementModCount();
        mc++;
        tab[i] = REMOVED_BITS;
        postRemoveHook();
        changed = true;
      }
    }
  }
  if (mc != modCount())
    throw new java.util.ConcurrentModificationException();
  return changed;
}

代码示例来源:origin: net.openhft/koloboke-impl-jdk8

@Override
public void forEachRemaining(@Nonnull Consumer<? super Map.Entry<Double, Long>> action) {
  if (action == null)
    throw new java.lang.NullPointerException();
  long[] tab = this.tab;
  int nextI = nextIndex;
  for (int i = nextI; i >= 0; i -= 2) {
    long key;
    if ((key = tab[i]) < FREE_BITS) {
      action.accept(new ImmutableEntry(key, tab[i + 1]));
    }
  }
  if (nextI != nextIndex) {
    throw new java.util.ConcurrentModificationException();
  }
  nextIndex = -1;
}

代码示例来源:origin: com.koloboke/koloboke-impl-jdk8

@Override
public boolean forEachWhile(@Nonnull  Predicate<? super Map.Entry<Double, Double>> predicate) {
  if (predicate == null)
    throw new java.lang.NullPointerException();
  if (this.isEmpty())
    return true;
  boolean terminated = false;
  int mc = modCount();
  long[] tab = table;
  for (int i = tab.length - 2; i >= 0; i -= 2) {
    long key;
    if ((key = tab[i]) < FREE_BITS) {
      if (!predicate.test(new MutableEntry(mc, i, key, tab[i + 1]))) {
        terminated = true;
        break;
      }
    }
  }
  if (mc != modCount())
    throw new java.util.ConcurrentModificationException();
  return !terminated;
}

代码示例来源:origin: com.koloboke/koloboke-impl-jdk8

public void forEach(Consumer<? super Double> action) {
  if (action == null)
    throw new java.lang.NullPointerException();
  if (this.isEmpty())
    return;
  int mc = modCount();
  long[] tab = table;
  for (int i = tab.length - 2; i >= 0; i -= 2) {
    long key;
    if ((key = tab[i]) < FREE_BITS) {
      action.accept(Double.longBitsToDouble(key));
    }
  }
  if (mc != modCount())
    throw new java.util.ConcurrentModificationException();
}

代码示例来源:origin: com.github.bloodshura/shurax

@Nonnull
@Override
public synchronized final E next() throws ConcurrentModificationException {
  if (!hasNext()) {
    throw new ConcurrentModificationException("No more elements (concurrency problem?)");
  }
  return get(++index);
}

相关文章