All Downloads are FREE. Search and download functionalities are using the official Maven repository.

wee0.lang.IList Maven / Gradle / Ivy

The newest version!
/**
 * Copyright (c) 2016-2022, wee0.com.
 *
 * 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.
 **/
package wee0.lang;

import java.util.List;
import java.util.function.Consumer;

/**
 * 列表集合对象
 * @author		baihw
 * @date 		2016年12月29日
 **/

/**
 * 
 *  examples:
 * 
**/ public interface IList extends IObject{ /** * 当前对象数据类型 */ String TYPE = "wee0.lang.List"; @Override default String getType(){ return TYPE; } /** * 增加一个对象 * * @param obj 要增加的对象 * @return 当前对象,便于后续的链式操作。 */ IList add( IObject obj ); /** * 在指定索引位置增加一个对象 * * @param index 索引位置 * @param obj 要增加的对象 * @return 当前对象,便于后续的链式操作。 */ IList add( int index, IObject obj ); /** * 将指定集合中的数据追加到当前集合中。 * * @param data 待追加的数据集合 * @return 当前对象,便于后续的链式操作。 */ IList addAll( IList data ); /** * 将指定集合中的数据追加到当前集合中的指定索引位置。 * * @param index 索引位置 * @param data 待追加的数据集合 * @return 当前对象,便于后续的链式操作。 */ IList addAll( int index, IList data ); /** * 设置指定索引位置对象 * * @param index 索引位置 * @param obj 对象 * @return 当前对象,便于后续的链式操作。 */ IList set( int index, IObject obj ); /** * 移除指定索引位置对象 * * @param index 索引位置 * @return 被移除的对象 */ IObject remove( int index ); /** * 移除指定对象 * * @param obj 要移除的对象 * @return 修改后的当前对象,便于后续的链式操作。 */ IList remove( IObject obj ); /** * 移除指定集合中包含的对象 * @param objs 要移除的对象集合 * @return 修改后的当前对象,便于后续的链式操作。 */ IList removeAll( IList objs ) ; /** * 清空数据 * * @return 当前对象,便于后续的链式操作。 */ IList clear(); /** * 集合是否为空。 * * @return true / false */ boolean isEmpty(); /** * 检查集合中是否包含指定的的对象。 * * @param obj 要检查是否包含的对象 * @return true / false */ boolean has( IObject obj ); /** * 获取指定索引位置对象 * * @param index 索引位置 * @param defValue 数据不存在时返回的默认数据 * @return 值数据 / 默认数据 */ IObject get( int index, IObject defValue ); /** * 获取指定索引位置对象 * * @param index 索引位置 * @return 对象 */ IObject get( int index ); /** * 获取指定索引位置对应的字符串类型数据 * * @param index 索引位置 * @return 值数据 / 默认空字符串数据 */ IString getString( int index ); /** * 获取指定索引位置对应的字符串类型数据 * * @param index 索引位置 * @param defValue 数据不存在时返回的默认数据 * @return 值数据 / 默认数据 */ IString getString( int index, IString defValue ); /** * 获取指定索引位置对应的数值类型数据 * * @param index 索引位置 * @param defValue 数据不存在时返回的默认数据 * @return 值数据 / 默认数据 */ INumber getNumber( int index, INumber defValue ); /** * 获取指定索引位置对应的布尔类型数据 * * @param index 索引位置 * @param defValue 数据不存在时返回的默认数据 * @return 值数据 / 默认数据 */ IBoolean getBoolean( int index, IBoolean defValue ); /** * 获取指定索引位置对应的键值集合类型数据。 * * @param index 索引位置 * @param defValue 数据不存在时返回的默认数据 * @return 值数据 / 默认数据 */ IMap getMap( int index, IMap defValue ); /** * 获取指定索引位置对应的列表集合类型数据。 * * @param index 索引位置 * @param defValue 数据不存在时返回的默认数据 * @return 值数据 / 默认数据 */ IList getList( int index, IList defValue ); /** * 遍历数据方法 * * @param action 数据接收处理逻辑 */ void forEach( Consumer action ); /********************************************************** * 原生数据类型操作支持部分。 **********************************************************/ /** * 获取指定索引位置对应的原生类型字符串数据 * * @param index 索引位置 * @param defValue 数据不存在时返回的默认数据 * @return 值数据 / 默认数据 */ String getNativeString( int index, String defValue ); /** * 获取指定索引位置对应的前后去空格字符串参数,不存在或者为空字符串时返回指定的默认值。 * * @param index 索引位置 * @param defValue 参数不存在或者为空字符串时返回的默认值 * @return 前后去空格的字符串参数 / 默认值 */ String getNativeTrimString( int index, String defValue ); /** * 获取指定索引位置对应的数字值。 * * @param index 索引位置 * @param defValue 值不存在时返回的默认值 * @return 键值数字 */ Number getNativeNumber( int index, Number defValue ); /** * 获取指定索引位置对应的真假值。 * * @param index 索引位置 * @param defValue 值不存在时返回的默认值 * @return 布尔键值 */ boolean getNativeBoolean( int index, boolean defValue ); /** * 获取平台原生集合类型。 * * @return 平台原生集合类型 */ List nativeValue(); } // end interface




© 2015 - 2025 Weber Informatics LLC | Privacy Policy