https://github.com/hexlet-components/java-arrays-as-sets
https://github.com/hexlet-components/java-arrays-as-sets
Last synced: 5 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/hexlet-components/java-arrays-as-sets
- Owner: hexlet-components
- Created: 2022-01-17T01:39:48.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2025-04-22T09:17:33.000Z (about 1 year ago)
- Last Synced: 2025-04-22T10:42:39.142Z (about 1 year ago)
- Language: Java
- Size: 79.1 KB
- Stars: 5
- Watchers: 9
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# java-arrays-as-sets
## Usage
### Intersection
```java
import static io.hexlet.utils.ArraysAsSets;
String[] firstNames = {"Vasya", "Kolya", "Petya"};
String[] secondNames = {"Igor", "Petya", "Sergey", "Vasya", "Sasha"};
intersection(firstNames, secondNames);
// ["Vasya", "Petya"]
```
### Union
```java
import static io.hexlet.utils.ArraysAsSets;
String[] firstNames = {"Vasya", "Kolya", "Petya"};
String[] secondNames = {"Igor", "Petya", "Sergey", "Vasya", "Sasha"};
union(firstNames, secondNames);
// ["Petya", "Sasha", "Igor", "Kolya", "Vasya", "Sergey"]
```
### Difference
```java
import static io.hexlet.utils.ArraysAsSets;
String[] firstNames = {"Vasya", "Kolya", "Petya"};
String[] secondNames = {"Igor", "Petya", "Sergey", "Vasya", "Sasha"};
difference(firstNames, secondNames);
// ["Kolya"]
```
[](https://hexlet.io?utm_source=github&utm_medium=link&utm_campaign=java-arrays-as-sets)
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-arrays-as-sets).
See most active contributors on [hexlet-friends](https://friends.hexlet.io/).