Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/**
* The MIT License (MIT)
*
* Copyright (c) 2019 nobark (tools4j), Marco Terzer, Anton Anufriev
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.tools4j.nobark.queue;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.function.Supplier;
/**
* Builder for the different types of conflation queues serving as alternative to the queue constructors; a builder is
* returned by the static methods of this interface.
*
* @param the type of the conflation key
* @param the type of elements in the queue
*/
public interface ConflationQueueBuilder {
/**
* Creates an initial builder; use this method only when conflation keys are not known in advance
*
* @param the type of the conflation key
* @param the type of elements in the queue
* @return a new builder
*/
static ConflationQueueBuilder builder() {
return new ConflationQueueBuilderImpl.DefaultBuilder<>();
}
/**
* Creates an initial builder; use this method only when conflation keys are not known in advance.
*
* @param keyType the type of the conflation key, used only to infer the generic type of the builder
* @param valueType the type of elements in the queue, used only to infer the generic type of the builder
* @param the type of the conflation key
* @param the type of elements in the queue
* @return a new builder
*/
static ConflationQueueBuilder builder(@SuppressWarnings("unused") final Class keyType,
@SuppressWarnings("unused") final Class valueType) {
return new ConflationQueueBuilderImpl.DefaultBuilder<>();
}
/**
* Creates an initial builder; use this method only when conflation keys are not known in advance. If multiple
* producers are used, the map returned by the given map factory should be thread-safe.
*
* @param entryMapFactory the factory to create the map that manages entries per conflation key
* @param the type of the conflation key
* @param the type of elements in the queue
* @return a new builder
*/
static ConflationQueueBuilder builder(final Supplier extends Map