This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class HowToUseIt { | |
/** | |
* Usually we'll have a single instance per client | |
*/ | |
private static final SingleThreadPool THREAD_POOL = new SingleThreadPool(); | |
public void executeAsync() { | |
try { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.triadworks.tinyobjects; | |
import java.util.Date; | |
public class Intervalo { | |
private static int ONE_DAY_IN_MILLISECONDS = 24 * 60 * 60 * 1000; | |
private Date inicio; | |
private Date fim; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import static java.util.Comparator.naturalOrder; | |
import static java.util.function.Function.identity; | |
import static java.util.stream.Collectors.counting; | |
import static java.util.stream.Collectors.groupingBy; | |
import java.util.stream.Collectors; | |
import java.util.stream.Comparator; | |
import java.util.*; | |
public class Sorteio { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Criteria criteria = getSession().createCriteria(PagueLeve.class); | |
criteria.createAlias("itens", "itens", Criteria.INNER_JOIN); | |
criteria.add(Restrictions.ge("dataFinal", venda.getInicio())) // start1 <= end2 | |
.add(Restrictions.le("dataInicial", venda.getFim())) // start2 <= end1 | |
.add(Restrictions.in("itens.codigo", venda.getCodigosDosProdutosAssociados())); | |
criteria.setProjection(Projections.distinct( | |
Projections.projectionList() | |
.add(Projections.property("codigo").as("codigo")) |