Java implenetations of list() and head().
Find a file
dependabot[bot] 79f524ef1d
Bump tiles-maven-plugin from 2.20 to 2.21 (#17)
Bumps [tiles-maven-plugin](https://github.com/repaint-io/maven-tiles) from 2.20 to 2.21.
- [Release notes](https://github.com/repaint-io/maven-tiles/releases)
- [Changelog](https://github.com/repaint-io/maven-tiles/blob/master/CHANGELOG.adoc)
- [Commits](https://github.com/repaint-io/maven-tiles/compare/tiles-maven-plugin-2.20...tiles-maven-plugin-2.21)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-06 10:31:41 +01:00
.github Upgrade to GitHub-native Dependabot (#16) 2021-04-30 11:12:04 +01:00
src Initial import 2020-04-02 20:07:30 +01:00
.gitignore Initial import 2020-04-02 20:07:30 +01:00
LICENSE Initial commit 2020-04-02 20:06:17 +01:00
pom.xml Bump tiles-maven-plugin from 2.20 to 2.21 (#17) 2021-05-06 10:31:41 +01:00
README.md Initial import 2020-04-02 20:07:30 +01:00

List Head/Tail

Sonatype Nexus (Release) Maven Central

Provides a head() and tail() implementation for List<> objects in Java.

Usage

import net.kemitix.list.HeadTail;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
class Usage {
  List<String> list = Arrays.asList("a", "b", "c");
  Optional<String> head = HeadTail.head(list);      // head()
  assertThat(head).contains("a");
  List<String> tail = HeadTail.tail(list);          // tail()
  assertThat(tail).containsExactly("b", "c");
}

Statically importing the head() and tail() methods will be more readable and idiomatically FP.

import static net.kemitix.list.HeadTail.*;
import java.util.List;
import static org.assertj.core.api.Assertions.assertThat;
class Usage {
  List<String> list = Arrays.asList("a", "b", "c");
  Optional<String> head = head(list);               // head()
  assertThat(head).contains("a");
  List<String> tail = tail(list);                   // tail()
  assertThat(tail).containsExactly("b", "c");
}