English 中文(简体)
是否有一条可允许由另一个法院传唤的驱逐?
原标题:Is there an Iterable which allows Iterable.remove() to be called by another instance?

清单物体是否有瓜瓦激光器(或方法),使2个探测器在相同的记忆范围内存在,同时允许移除()操作? (Bonus点:如果它为收集工作的话)。

例使用案例:通过收集进行外部和内部循环,如果内ner可能决定去除元素,外 lo随后会跳出。

• 判断如何通过减少 elements形元素的数量来使以下概念代码(使用瓜瓦静态进口)受益,并排除最终从清单中删除空壳的必要性:

private <T> Set<Set<T>> disjointify(Collection<Set<T>> sets) {
    List<Set<T>> disjoint = newArrayList(sets);
    for (Set<T> set1 : disjoint) {
        for (Set<T> set2 : filter(disjoint, not(equalTo(set1)))) {
            if (!intersection(set1, set2).isEmpty()) {
                // this wouldn t be safe for a Set<Set<T>>
                set1.addAll(set2);
                set2.clear();
            }
        }
    }
    return newHashSet(filter(disjoint, NO_EMPTIES));
}
private static final Predicate<Set<?>> NO_EMPTIES = new Predicate<Set<?>>() {

    @Override
    public boolean apply(Set<?> input) {
        if (input == null || input.isEmpty()) {
            return false;
        }
        return true;
    }
};

说明:人们可以很容易想象一下,特别是为了联系人,我只想问一下是否在此存在。

就记录而言,如果已经具备了高效率和可操作的元件,那么使用案例就好像如下(我制造了我自己的非常低的、能够做到这一点的灵丹妙药,但50条线长,而且明显缺乏效率,因此我使用上述原始代码):

private <T> void disjointify(Set<Set<T>> sets) {
    for (Set<T> set1 : nestable(sets)) {
        Iterator<Set<T>> it = filter(nestable(sets), not(equalTo(set1))).iterator();
        while (it.hasNext()) {
            Set<T> set2 = it.next();
            if (!intersection(set1, set2).isEmpty()) {
                set1.addAll(set2);
                it.remove();
            }
        }
    }
}
最佳回答

标准图书馆似乎不存在这种执行。

问题回答

为什么不要把外观与诺-EMPTIES混为一谈? 由于过滤过程中对过滤器进行了评价,因此任何新空置的装置都不会在过滤清单/外壳中退回。

Otherwise, I don t think so. You would get a ConcurrentModificationException on the outter loop.





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签