com.github.shepherdviolet.glacimon.java.misc.StreamingBuildable Maven / Gradle / Ivy
/*
* Copyright (C) 2022-2023 S.Violet
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Project GitHub: https://github.com/shepherdviolet/glacimon
* Email: [email protected]
*/
package com.github.shepherdviolet.glacimon.java.misc;
/**
* [非线程安全|NOT THREAD SAFE] 流式创建Map/Set/Object/List
*
* @author shepherdviolet
*/
public interface StreamingBuildable {
/**
* 流式创建一个HashMap
* @param key type
* @param value type
*/
default StreamingBuilder.MapKeySetter buildHashMap() {
return StreamingBuilder.hashMap();
}
/**
* 流式创建一个LinkedHashMap
* @param key type
* @param value type
*/
default StreamingBuilder.MapKeySetter buildLinkedHashMap() {
return StreamingBuilder.linkedHashMap();
}
/**
* 流式创建一个ArrayList
* @param element type
*/
default StreamingBuilder.ListElementAdder buildArrayList() {
return StreamingBuilder.arrayList();
}
/**
* 流式创建一个LinkedList
* @param element type
*/
default StreamingBuilder.ListElementAdder buildLinkedList() {
return StreamingBuilder.linkedList();
}
/**
* 流式创建一个Set
* @param element type
*/
default StreamingBuilder.SetElementAdder buildHashSet() {
return StreamingBuilder.hashSet();
}
}