Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions concepts/streams/.meta/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"blurb": "Java Streams provide a powerful way to process collections using a functional approach.",
"authors": ["Navaneedan S"],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For Exercism to award you reputation points, this should be your Github username navaneedan07.

"contributors": []
}

21 changes: 21 additions & 0 deletions concepts/streams/about.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# About Streams
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The about is missing the information contained in the introduction (e.g. being able to get a stream with List.stream(), examples of how to get and use streams, etc.).

The about.md instead of the introduction.md is shown after the student finishes the concept. It should contain at least the same information from the introduction.md, although it can go into greater detail (see File: about.md for a greater description).

I also recommend looking at existing concepts and their introduction.md and about.md to get a feel of it.


**Streams** are a functional abstraction for processing sequences of data in Java.
Unlike collections like [`List`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/List.html), a [`Stream`](https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/stream/Stream.html) does not store elements—it describes a pipeline of operations to transform or compute data.

Streams are typically created from collections, arrays, or manually using `Stream.of(...)`.

For example:

```java
Stream<String> emptyStream = Stream.of();
Stream<Integer> singleInteger = Stream.of(1);
Stream<Boolean> threeBooleans = Stream.of(true, false, true);
Stream<Object> mixedTypes = Stream.of("hello", 1, true); // allowed in Stream<Object>
```


Check failure on line 17 in concepts/streams/about.md

View workflow job for this annotation

GitHub Actions / Lint Markdown files

Multiple consecutive blank lines

concepts/streams/about.md:17 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md012.md
[Java Stream API Overview]:https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/stream/package-summary.html

Check failure on line 18 in concepts/streams/about.md

View workflow job for this annotation

GitHub Actions / Lint Markdown files

Link and image reference definitions should be needed

concepts/streams/about.md:18:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "java stream api overview"] [Context: "[Java Stream API Overview]:htt..."] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md053.md
[Collectors Class]:https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/stream/Collectors.html

Check failure on line 19 in concepts/streams/about.md

View workflow job for this annotation

GitHub Actions / Lint Markdown files

Link and image reference definitions should be needed

concepts/streams/about.md:19:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "collectors class"] [Context: "[Collectors Class]:https://doc..."] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md053.md
[Stream Interface Documentation]:https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/stream/Stream.html

Check failure on line 20 in concepts/streams/about.md

View workflow job for this annotation

GitHub Actions / Lint Markdown files

Link and image reference definitions should be needed

concepts/streams/about.md:20:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "stream interface documentation"] [Context: "[Stream Interface Documentatio..."] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md053.md
[Stream Operations Explained]:https://www.geeksforgeeks.org/stream-in-java/

Check failure on line 21 in concepts/streams/about.md

View workflow job for this annotation

GitHub Actions / Lint Markdown files

Link and image reference definitions should be needed

concepts/streams/about.md:21:1 MD053/link-image-reference-definitions Link and image reference definitions should be needed [Unused link or image reference definition: "stream operations explained"] [Context: "[Stream Operations Explained]:..."] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md053.md
15 changes: 15 additions & 0 deletions concepts/streams/introduction.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Introduction to Streams

**Streams** are part of Java’s functional programming toolkit. They allow you to process collections in a declarative style—focusing on *what* to do, not *how* to do it.

You can create streams from collections like `List`, `Set`, or arrays, and then apply operations like `filter`, `map`, and `reduce` to transform or analyze the data.

## Examples

### Filtering a List

Check failure on line 9 in concepts/streams/introduction.md

View workflow job for this annotation

GitHub Actions / Lint Markdown files

Headings should be surrounded by blank lines

concepts/streams/introduction.md:9 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "### Filtering a List"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md022.md
```java

Check failure on line 10 in concepts/streams/introduction.md

View workflow job for this annotation

GitHub Actions / Lint Markdown files

Fenced code blocks should be surrounded by blank lines

concepts/streams/introduction.md:10 MD031/blanks-around-fences Fenced code blocks should be surrounded by blank lines [Context: "```java"] https://github.com/DavidAnson/markdownlint/blob/v0.38.0/doc/md031.md
List<String> names = List.of("Akash", "James", "Charles");
List<String> filtered = names.stream()
.filter(name -> name.startsWith("A"))
.collect(Collectors.toList());
// filtered is ["Akash"]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't sure if this is still a work in progress - the closing triple backticks are missing 😅. If not, I think it would be great to have examples for map and reduce since they are also mentioned.

18 changes: 18 additions & 0 deletions concepts/streams/links.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"url": "https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/stream/package-summary.html",
"description": "Java Stream API Overview"
},
{
"url": "https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/stream/Collectors.html",
"description": "Collectors Class"
},
{
"url": "https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/util/stream/Stream.html",
"description": "Stream Interface Documentation"
},
{
"url": "https://www.geeksforgeeks.org/stream-in-java/",
"description": "Stream Operations Explained"
}
]
Loading