package com.voodoodyne.gstrap.gae.taskqueue;

import com.google.appengine.api.taskqueue.QueueFactory;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * Utilitiy method for dealing with queues
 */
public class Queues
{
	/** 'default' is a java keyword */
	public static QueueHelper deflt() {
		return new SimpleQueueHelper(QueueFactory.getDefaultQueue());
	}

	/**
	 */
	public static QueueHelper named(final String queueName) {
		return new SimpleQueueHelper(queueName);
	}

	/**
	 * Add the tasks to their default queues in the most optimum way possible.
	 */
	public static <T extends GuicyDeferredTask> void add(final Collection<T> tasks) {
		final Map<QueueHelper, List<T>> byQueue = tasks.stream().collect(Collectors.groupingBy(GuicyDeferredTask::defaultQueue));

		byQueue.forEach(QueueHelper::add);
	}
}

package com.voodoodyne.gstrap.gae.taskqueue;

import com.google.appengine.api.taskqueue.QueueFactory;
import com.voodoodyne.gstrap.taskqueue.SimpleQueueHelper;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * Utilitiy method for dealing with queues
 */
public class Queues
{
	/** 'default' is a java keyword */
	public static QueueHelper deflt() {
		return new QueueHelper(QueueFactory.getDefaultQueue());
	}

	/**
	 */
	public static QueueHelper named(final String queueName) {
		return new QueueHelper(queueName);
	}

	/**
	 * Add the tasks to their default queues in the most optimum way possible.
	 */
	public static <T extends GuicyDeferredTask> void add(final Collection<T> tasks) {
		final Map<QueueHelper, List<T>> byQueue = tasks.stream().collect(Collectors.groupingBy(GuicyDeferredTask::defaultQueue));

		byQueue.forEach(QueueHelper::add);
	}
}

Fix Queues.java after helper refactor