https://github.com/hexlet-components/java-pairs
https://github.com/hexlet-components/java-pairs
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hexlet-components/java-pairs
- Owner: hexlet-components
- Created: 2019-11-17T13:19:53.000Z (over 6 years ago)
- Default Branch: main
- Last Pushed: 2025-04-18T07:36:27.000Z (about 1 year ago)
- Last Synced: 2025-04-18T21:39:04.954Z (about 1 year ago)
- Language: Java
- Size: 172 KB
- Stars: 1
- Watchers: 10
- Forks: 5
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# java-pairs
[](https://github.com/hexlet-components/java-pairs/actions)
[](https://jitpack.io/#hexlet-components/java-pairs)
## Functions for working with Pairs
```java
import static io.hexlet.pairs.Pair.car;
import static io.hexlet.pairs.Pair.cdr;
import static io.hexlet.pairs.Pair.cons;
import static io.hexlet.pairs.Pair.pairToString;
import static io.hexlet.pairs.Pair.isPair;
```
## Usage examples
```java
var pair = cons(1, 2);
var one = car(pair); // one = 1;
var two = cdr(pair); // two = 2;
var isPair = isPair(pair); // isPair == true;
var result = pairToString(pair); // pair = "(1, 2)";
```
---
[](https://hexlet.io?utm_source=github&utm_medium=link&utm_campaign=java-pairs)
This repository is created and maintained by the team and the community of Hexlet, an educational project. [Read more about Hexlet](https://hexlet.io?utm_source=github&utm_medium=link&utm_campaign=java-pairs).
See most active contributors on [hexlet-friends](https://friends.hexlet.io/).