내가 그래서 내가 여부를 걱정겠습니까이 원인 가비지 컬렉션 (Garbage Collection)은
Iterable<? extends NewOrder > currentlyAssigned =
IterableQuery.
from(orders).
where(placedInLast10Days).
orderBy(lastName).
select(orderToNewOrder);
더 간결하고 읽기 쉬운 방식으로 쿼리 모음을 할 수 Google Collections
public class IterableQuery {
public static <T> Where<T> from(Iterable<T> originalCollection) {
return new Where<T>(Iterables.transform(originalCollection, IterableQuery.<T>SAME()));
}
private static <T> Function<T, T> SAME() {
return new Function<T, T>(){
public T apply(T arg0) {
return arg0;
}
};
}
public static class SelectOrderBy<T>{
private final Iterable<T> iterable;
public SelectOrderBy(Iterable<T> iteable) {
this.iterable = iteable;
}
public SelectOrderBy<T> orderyBy(Comparator<T> sort){
Ordering.forComparator(sort).sort((List< ? extends T>) iterable);
return new SelectOrderBy<T>(iterable);
}
public <F> Iterable<F> select( Function<? super T,? extends F> function){
return Iterables.transform(iterable, function);
}
public Iterable<T> selectEveryThing(){
return iterable;
}
}
public static class Where<T>{
private final Iterable<T> iterable;
public Where(Iterable<T> iterable) {
this.iterable = iterable;
}
public SelectOrderBy<T> where(Predicate<T> predicate) {
return new SelectOrderBy<T>(Iterables.filter(iterable, predicate));
}
}
}
위에 DSL 같은 작은 Linq에 쓴 발행 이 접근법은 미니 객체의 폭발을 유발하고 일부 가비지 콜렉션 문제 (또는 다른 문제)를 유발할 수 있습니까?
가비지 수집에 문제가 있습니까? 나는 그것에 대해 걱정하지 않기 위해 관리되는 언어로 프로그램한다. –