1 Star 1 Fork 0

Jon / tuples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

Tuples

简介

元组是一个可以保存多个值的数据结构,而且可保存不同类型的值。

该框架是元组的一个简单的实现,不仅可以方便的存入数据,也可以从中取得想要的数据类型的数据(自动类型转换)。

示例

Tuple tuple = new Tuple();
tuple.add("A");
tuple.add(123);
tuple.add(13.14);
tuple.add("test", "test");// 可为值指定名称,方便使用名称读取数据。如果相同名称的值已经存在,则会覆盖已经存在的值

tuple.add(1, "abc");// 也可以指定索引,在指定位置插入数据

// 获取数据
tuple.get(0);// 使用索引获取
tuple.getString("test");// 使用名称获取

// 移除数据
tuple.remove(value);// 移除指定的元素
tuple.removeName(name);// 移除指定名称的元素
tuple.removeIndex(index);// 移除指定索引的元素

/**
 * 关于接口中的参数:
 * name: 元素的名称,如果添加时没有指定名称,则为 null
 * index: 元素在元组中的索引
 * value: 元素
 */
tuple.forEach((name, index, value) -> {});

使用

Maven

在项目的pom.xml的dependencies中加入以下内容:

<dependency>
    <groupId>com.github.jonzhang3</groupId>
    <artifactId>tuples</artifactId>
    <version>1.0.0</version>
</dependency>
MIT License Copyright (c) 2020 JonZhang 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.

简介

A simple tuple tool. 展开 收起
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/jonzhang-3/tuples.git
git@gitee.com:jonzhang-3/tuples.git
jonzhang-3
tuples
tuples
master

搜索帮助