Skip to content
Snippets Groups Projects
Unverified Commit 4cf944a3 authored by Peter Kurfer's avatar Peter Kurfer
Browse files

Completed first draft of spec

parent d5b49ca5
No related branches found
No related tags found
No related merge requests found
# 12-functional-cli
\ No newline at end of file
_This is an assignment to the class [Programmieren 3](https://hsro-inf-prg3.github.io) at the [University of Applied Sciences Rosenheim](http://www.fh-rosenheim.de)._
# Assignment 12: Functional - CLI variant
This assignment covers the basics of the Java 8 `Stream` API.
Streams are a functional concept and are relatively new in Java but they are very useful in combination with all kinds of _iterable_ data sources.
Streams may look a little bit complicated but when you got the concept they improve the readability of your code because they are more _data pipeline_ oriented as normal Java code is where you always have to iterate a collection with any kind of loop.
## Setup
1. Create a fork of this repository (button in the right upper corner)
1. Clone the project (get the link by clicking the green _Clone or download button_)
1. Import the project to your **IntelliJ**
_Remark: the given test suite will not completely succeed until you completed the first part of the assignment._
## Generators
A generator is component that creates a `Stream`.
There are two kinds of streams:
* finite
* infinite
A stream based on a list of objects is a finite stream as there are only a discrete number of elements that can be iterated.
Infinite streams are seaming to be a little bit weard but they are also very useful.
Think of a pseudo random number generator.
An infinite stream may be used to produce as many random numbers as required.
This generator may be implemented like this:
```java
public abstract class PseudoRandomNumberGenerator {
private PseudoRandomNumberGenerator() {
}
public static Stream<Integer> createStream() {
return Stream.generate(new PseudoRandomNumberSupplier());
}
private static class PseudoRandomNumberSupplier implements Supplier<Integer> {
private final Random random = new Random();
@Override
public Integer get() {
return random.nextInt();
}
}
}
```
The stream may be used like this:
```java
Stream<Integer> prngStream = createStream();
prngStream
.limit(10)
.forEach(System.out::println);
```
_Note that the `limit(...)` operation is mandatory because the stream is infinite and otherwise the whole operation will not terminate!_
In this part of the assignment you have to implement two generators as shown in the following UML:
![Generator spec](./assets/images/GeneratorSpec.svg)
_Remark: the UML is incomplete and is meant as implementation hint!_
1. Implement the `RandomJokeSupplier` - this supplier returns a random joke everytime it is used.
1. Implement the `AllJokesSupplier` - this supplier iterates all jokes in an infinite loop i.e. if all jokes were retrieved it continues with the first joke.
1. Implement the `JokeGenerator` - the generator returns infinite streams based on the implemented suppliers.
Note that the class structure is already there.
_Side note: when you have completed the implementation of the suppliers and the generator you can test your implementation with the given test suite._
## Using the generators
The given class `App` already implements a basic _CLI_ interface.
To complete the assignment implement the required code marked with a _TODO_.
The following flow diagram explains how to use the `jokesSource`:
![Stream flow](./assets/images/StreamFlow.svg)
Every chart element corresponds to a single method call on the stream of jokes.
For further reading about the Java 8 streams have a look at [this article](http://winterbe.com/posts/2014/07/31/java8-stream-tutorial-examples/).
_Remark: this part is technically an one-liner. To improve the readability add line breaks after every stream transformation. That should result in 5-6 lines of code._
If you want to improve your knowledge about streams you could extend the assignment by asking the user if he wants to filter the jokes for a specific category and if so which category (read the category as string).
Then `filter` the stream after the _unwrap_ transformation for the chosen category.
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="386px" preserveAspectRatio="none" style="width:586px;height:386px;" version="1.1" viewBox="0 0 586 386" width="586px" zoomAndPan="magnify"><defs><filter height="300%" id="ff5x8r6f147bv" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><!--cluster java.util.function--><polygon fill="#FFFFFF" filter="url(#ff5x8r6f147bv)" points="14,156,150,156,157,178.2969,160,178.2969,160,252,14,252,14,156" style="stroke: #000000; stroke-width: 1.5;"/><line style="stroke: #000000; stroke-width: 1.5;" x1="14" x2="157" y1="178.2969" y2="178.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="130" x="18" y="170.9951">java.util.function</text><!--cluster de.fhro.inf.prg3.a12.icndb--><polygon fill="#FFFFFF" filter="url(#ff5x8r6f147bv)" points="168,16,381,16,388,38.2969,564,38.2969,564,374,168,374,168,16" style="stroke: #000000; stroke-width: 1.5;"/><line style="stroke: #000000; stroke-width: 1.5;" x1="168" x2="388" y1="38.2969" y2="38.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="207" x="172" y="30.9951">de.fhro.inf.prg3.a12.icndb</text><!--cluster suppliers--><polygon fill="#FFFFFF" filter="url(#ff5x8r6f147bv)" points="176,283,255,283,262,305.2969,517,305.2969,517,366,176,366,176,283" style="stroke: #000000; stroke-width: 1.5;"/><line style="stroke: #000000; stroke-width: 1.5;" x1="176" x2="262" y1="305.2969" y2="305.2969"/><text fill="#000000" font-family="sans-serif" font-size="14" font-weight="bold" lengthAdjust="spacingAndGlyphs" textLength="73" x="180" y="297.9951">suppliers</text><!--class Supplier--><rect fill="#FEFECE" filter="url(#ff5x8r6f147bv)" height="60.8047" id="Supplier" style="stroke: #A80036; stroke-width: 1.5;" width="94" x="58" y="183"/><ellipse cx="73" cy="199" fill="#B4A7E5" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M68.9219,194.7656 L68.9219,192.6094 L76.3125,192.6094 L76.3125,194.7656 L73.8438,194.7656 L73.8438,202.8438 L76.3125,202.8438 L76.3125,205 L68.9219,205 L68.9219,202.8438 L71.3906,202.8438 L71.3906,194.7656 L68.9219,194.7656 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="51" x="87" y="203.1543">Supplier</text><rect fill="#FFFFFF" height="15.9688" style="stroke: #000000; stroke-width: 1.0; stroke-dasharray: 2.0,2.0;" width="9" x="146" y="180"/><text fill="#000000" font-family="sans-serif" font-size="12" font-style="italic" lengthAdjust="spacingAndGlyphs" textLength="7" x="147" y="192.1387">T</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="59" x2="151" y1="215" y2="215"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="59" x2="151" y1="223" y2="223"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="41" x="64" y="237.2104">T get();</text><!--class JokeGenerator--><rect fill="#FEFECE" filter="url(#ff5x8r6f147bv)" height="73.6094" id="JokeGenerator" style="stroke: #A80036; stroke-width: 1.5;" width="381" x="175.5" y="43"/><ellipse cx="316.75" cy="59" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M319.7188,64.6406 Q319.1406,64.9375 318.5,65.0859 Q317.8594,65.2344 317.1563,65.2344 Q314.6563,65.2344 313.3359,63.5859 Q312.0156,61.9375 312.0156,58.8125 Q312.0156,55.6875 313.3359,54.0313 Q314.6563,52.375 317.1563,52.375 Q317.8594,52.375 318.5078,52.5313 Q319.1563,52.6875 319.7188,52.9844 L319.7188,55.7031 Q319.0938,55.125 318.5,54.8516 Q317.9063,54.5781 317.2813,54.5781 Q315.9375,54.5781 315.25,55.6484 Q314.5625,56.7188 314.5625,58.8125 Q314.5625,60.9063 315.25,61.9766 Q315.9375,63.0469 317.2813,63.0469 Q317.9063,63.0469 318.5,62.7734 Q319.0938,62.5 319.7188,61.9219 L319.7188,64.6406 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="90" x="337.25" y="63.1543">JokeGenerator</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="176.5" x2="555.5" y1="75" y2="75"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="176.5" x2="555.5" y1="83" y2="83"/><ellipse cx="186.5" cy="94.9023" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="355" x="195.5" y="97.2104">randomJokesStream(): Stream&lt;ResponseWrapper&lt;JokeDto&gt;&gt;</text><ellipse cx="186.5" cy="107.707" fill="#84BE84" rx="3" ry="3" style="stroke: #038048; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="11" lengthAdjust="spacingAndGlyphs" textLength="311" x="195.5" y="110.0151">jokesStream(): Stream&lt;ResponseWrapper&lt;JokeDto&gt;&gt;</text><!--class AllJokesSupplier--><rect fill="#FEFECE" filter="url(#ff5x8r6f147bv)" height="48" id="AllJokesSupplier" style="stroke: #A80036; stroke-width: 1.5;" width="130" x="184" y="310"/><ellipse cx="199" cy="326" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M201.9688,331.6406 Q201.3906,331.9375 200.75,332.0859 Q200.1094,332.2344 199.4063,332.2344 Q196.9063,332.2344 195.5859,330.5859 Q194.2656,328.9375 194.2656,325.8125 Q194.2656,322.6875 195.5859,321.0313 Q196.9063,319.375 199.4063,319.375 Q200.1094,319.375 200.7578,319.5313 Q201.4063,319.6875 201.9688,319.9844 L201.9688,322.7031 Q201.3438,322.125 200.75,321.8516 Q200.1563,321.5781 199.5313,321.5781 Q198.1875,321.5781 197.5,322.6484 Q196.8125,323.7188 196.8125,325.8125 Q196.8125,327.9063 197.5,328.9766 Q198.1875,330.0469 199.5313,330.0469 Q200.1563,330.0469 200.75,329.7734 Q201.3438,329.5 201.9688,328.9219 L201.9688,331.6406 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="98" x="213" y="330.1543">AllJokesSupplier</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="185" x2="313" y1="342" y2="342"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="185" x2="313" y1="350" y2="350"/><!--class RandomJokeSupplier--><rect fill="#FEFECE" filter="url(#ff5x8r6f147bv)" height="48" id="RandomJokeSupplier" style="stroke: #A80036; stroke-width: 1.5;" width="160" x="349" y="310"/><ellipse cx="364" cy="326" fill="#ADD1B2" rx="11" ry="11" style="stroke: #A80036; stroke-width: 1.0;"/><path d="M366.9688,331.6406 Q366.3906,331.9375 365.75,332.0859 Q365.1094,332.2344 364.4063,332.2344 Q361.9063,332.2344 360.5859,330.5859 Q359.2656,328.9375 359.2656,325.8125 Q359.2656,322.6875 360.5859,321.0313 Q361.9063,319.375 364.4063,319.375 Q365.1094,319.375 365.7578,319.5313 Q366.4063,319.6875 366.9688,319.9844 L366.9688,322.7031 Q366.3438,322.125 365.75,321.8516 Q365.1563,321.5781 364.5313,321.5781 Q363.1875,321.5781 362.5,322.6484 Q361.8125,323.7188 361.8125,325.8125 Q361.8125,327.9063 362.5,328.9766 Q363.1875,330.0469 364.5313,330.0469 Q365.1563,330.0469 365.75,329.7734 Q366.3438,329.5 366.9688,328.9219 L366.9688,331.6406 Z "/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="128" x="378" y="330.1543">RandomJokeSupplier</text><line style="stroke: #A80036; stroke-width: 1.5;" x1="350" x2="508" y1="342" y2="342"/><line style="stroke: #A80036; stroke-width: 1.5;" x1="350" x2="508" y1="350" y2="350"/><!--link Supplier to AllJokesSupplier--><path d="M157.2865,257.2537 C178.4603,274.972 202.0984,294.7525 220.0732,309.7939 " fill="none" id="Supplier-AllJokesSupplier" style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 7.0,7.0;"/><polygon fill="none" points="152.5558,262.4225,141.7099,244.219,161.5404,251.6858,152.5558,262.4225" style="stroke: #A80036; stroke-width: 1.0;"/><!--link Supplier to RandomJokeSupplier--><path d="M163.812,253.2707 C191.239,267.1376 201.1037,269.6599 227,275 C272.8375,284.4522 287.0214,270.0639 332,283 C352.8447,288.9951 374.36,299.7643 391.8151,309.8668 " fill="none" id="Supplier-RandomJokeSupplier" style="stroke: #A80036; stroke-width: 1.0; stroke-dasharray: 7.0,7.0;"/><polygon fill="none" points="160.4923,259.4344,145.9722,244.0016,166.9471,247.0112,160.4923,259.4344" style="stroke: #A80036; stroke-width: 1.0;"/><!--link JokeGenerator to AllJokesSupplier--><path d="M348.8619,117.2058 C324.552,169.9812 280.7318,265.1121 260.1938,309.6989 " fill="none" id="JokeGenerator-AllJokesSupplier" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="30" x="331" y="218.0669">uses</text><!--link JokeGenerator to RandomJokeSupplier--><path d="M375.2282,117.2058 C388.3182,169.9812 411.9136,265.1121 422.9726,309.6989 " fill="none" id="JokeGenerator-RandomJokeSupplier" style="stroke: #A80036; stroke-width: 1.0;"/><text fill="#000000" font-family="sans-serif" font-size="13" lengthAdjust="spacingAndGlyphs" textLength="30" x="409" y="218.0669">uses</text><!--
@startuml GeneratorSpec
package java.util.function {
interface Supplier<T> {
T get();
}
}
package de.fhro.inf.prg3.a12.icndb {
class JokeGenerator {
+randomJokesStream(): Stream<ResponseWrapper<JokeDto>>
+jokesStream(): Stream<ResponseWrapper<JokeDto>>
}
package suppliers {
class AllJokesSupplier implements Supplier {
}
class RandomJokeSupplier implements Supplier {
}
}
JokeGenerator - - AllJokesSupplier : "uses"
JokeGenerator - - RandomJokeSupplier : "uses"
}
@enduml
PlantUML version 1.2017.20(Mon Dec 11 17:57:05 CET 2017)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Java Version: 1.8.0_144-b01
Operating System: Linux
OS Version: 4.14.8-1-ARCH
Default Encoding: UTF-8
Language: en
Country: US
--></g></svg>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8" standalone="no"?><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" contentScriptType="application/ecmascript" contentStyleType="text/css" height="469px" preserveAspectRatio="none" style="width:355px;height:469px;" version="1.1" viewBox="0 0 355 469" width="355px" zoomAndPan="magnify"><defs><filter height="300%" id="f9zskfbuzy97j" width="300%" x="-1" y="-1"><feGaussianBlur result="blurOut" stdDeviation="2.0"/><feColorMatrix in="blurOut" result="blurOut2" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .4 0"/><feOffset dx="4.0" dy="4.0" in="blurOut2" result="blurOut3"/><feBlend in="SourceGraphic" in2="blurOut3" mode="normal"/></filter></defs><g><ellipse cx="175" cy="18" fill="#000000" filter="url(#f9zskfbuzy97j)" rx="10" ry="10" style="stroke: none; stroke-width: 1.0;"/><rect fill="#FEFECE" filter="url(#f9zskfbuzy97j)" height="33.9688" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="176" x="87" y="68"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="156" x="97" y="89.1387">Filter for non null objects</text><rect fill="#FEFECE" filter="url(#f9zskfbuzy97j)" height="33.9688" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="222" x="64" y="142"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="202" x="74" y="163.1387">Skip as many values as required</text><rect fill="#FEFECE" filter="url(#f9zskfbuzy97j)" height="33.9688" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="338" x="6" y="216"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="318" x="16" y="237.1387">Limit the stream to the required count of elements</text><rect fill="#FEFECE" filter="url(#f9zskfbuzy97j)" height="33.9688" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="309" x="20.5" y="290"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="289" x="30.5" y="311.1387">use `map` to unwrap the `ResponseWrapper`</text><rect fill="#FEFECE" filter="url(#f9zskfbuzy97j)" height="33.9688" rx="12.5" ry="12.5" style="stroke: #A80036; stroke-width: 1.5;" width="206" x="72" y="364"/><text fill="#000000" font-family="sans-serif" font-size="12" lengthAdjust="spacingAndGlyphs" textLength="186" x="82" y="385.1387">Print the jokes to the STDOUT</text><ellipse cx="175" cy="448" fill="none" filter="url(#f9zskfbuzy97j)" rx="10" ry="10" style="stroke: #000000; stroke-width: 1.0;"/><ellipse cx="175.5" cy="448.5" fill="#000000" rx="6" ry="6" style="stroke: none; stroke-width: 1.0;"/><!--link start to Filter for non null objects--><path d="M175,28.1759 C175,37.3186 175,51.0626 175,62.7436 " fill="none" id="start-Filter for non null objects" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="175,67.9414,179,58.9414,175,62.9414,171,58.9414,175,67.9414" style="stroke: #A80036; stroke-width: 1.0;"/><!--link Filter for non null objects to Skip as many values as required--><path d="M175,102.1631 C175,112.4368 175,125.6075 175,136.6831 " fill="none" id="Filter for non null objects-Skip as many values as required" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="175,141.93,179,132.93,175,136.93,171,132.93,175,141.93" style="stroke: #A80036; stroke-width: 1.0;"/><!--link Skip as many values as required to Limit the stream to the required count of elements--><path d="M175,176.1631 C175,186.4368 175,199.6075 175,210.6831 " fill="none" id="Skip as many values as required-Limit the stream to the required count of elements" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="175,215.93,179,206.93,175,210.93,171,206.93,175,215.93" style="stroke: #A80036; stroke-width: 1.0;"/><!--link Limit the stream to the required count of elements to use `map` to unwrap the `ResponseWrapper`--><path d="M175,250.1631 C175,260.4368 175,273.6075 175,284.6831 " fill="none" id="Limit the stream to the required count of elements-use `map` to unwrap the `ResponseWrapper`" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="175,289.93,179,280.93,175,284.93,171,280.93,175,289.93" style="stroke: #A80036; stroke-width: 1.0;"/><!--link use `map` to unwrap the `ResponseWrapper` to Print the jokes to the STDOUT--><path d="M175,324.1631 C175,334.4368 175,347.6075 175,358.6831 " fill="none" id="use `map` to unwrap the `ResponseWrapper`-Print the jokes to the STDOUT" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="175,363.93,179,354.93,175,358.93,171,354.93,175,363.93" style="stroke: #A80036; stroke-width: 1.0;"/><!--link Print the jokes to the STDOUT to end--><path d="M175,398.2542 C175,408.9518 175,422.5657 175,432.8464 " fill="none" id="Print the jokes to the STDOUT-end" style="stroke: #A80036; stroke-width: 1.0;"/><polygon fill="#A80036" points="175,437.8855,179,428.8855,175,432.8855,171,428.8855,175,437.8855" style="stroke: #A80036; stroke-width: 1.0;"/><!--
@startuml StreamFlow
(*) - -> "Filter for non null objects"
- -> "Skip as many values as required"
- -> "Limit the stream to the required count of elements"
- -> "use `map` to unwrap the `ResponseWrapper`"
- -> "Print the jokes to the STDOUT"
- -> (*)
@enduml
PlantUML version 1.2017.20(Mon Dec 11 17:57:05 CET 2017)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Java Version: 1.8.0_144-b01
Operating System: Linux
OS Version: 4.14.8-1-ARCH
Default Encoding: UTF-8
Language: en
Country: US
--></g></svg>
\ No newline at end of file
@startuml GeneratorSpec
package java.util.function {
interface Supplier<T> {
T get();
}
}
package de.fhro.inf.prg3.a12.icndb {
class JokeGenerator {
+randomJokesStream(): Stream<ResponseWrapper<JokeDto>>
+jokesStream(): Stream<ResponseWrapper<JokeDto>>
}
package suppliers {
class AllJokesSupplier implements Supplier {
}
class RandomJokeSupplier implements Supplier {
}
}
JokeGenerator -- AllJokesSupplier : "uses"
JokeGenerator -- RandomJokeSupplier : "uses"
}
@enduml
\ No newline at end of file
@startuml StreamFlow
(*) --> "Filter for non null objects"
--> "Skip as many values as required"
--> "Limit the stream to the required count of elements"
--> "use `map` to unwrap the `ResponseWrapper`"
--> "Print the jokes to the STDOUT"
--> (*)
@enduml
\ No newline at end of file
package de.fhro.inf.prg3.a12.icndb;
import java.util.stream.Stream;
import de.fhro.inf.prg3.a12.model.JokeDto;
import de.fhro.inf.prg3.a12.model.ResponseWrapper;
import org.apache.commons.lang3.NotImplementedException;
import java.util.stream.Stream;
/**
* @author Peter Kurfer
*/
......
......@@ -12,7 +12,7 @@ import org.apache.commons.lang3.NotImplementedException;
* @author Peter Kurfer
*/
public final class AllJokesSupplier implements Supplier<ResponseWrapper<JokeDto>> {
public final class AllJokesSupplier {
private final ICNDBApi icndbApi;
......@@ -22,7 +22,6 @@ public final class AllJokesSupplier implements Supplier<ResponseWrapper<JokeDto>
* to determine when all jokes are iterated and the counters have to be reset */
}
@Override
public ResponseWrapper<JokeDto> get() {
/* TODO retrieve the next joke
* note that there might be IDs that are not present in the database
......
......@@ -12,7 +12,7 @@ import org.apache.commons.lang3.NotImplementedException;
* @author Peter Kurfer
*/
public final class RandomJokeSupplier implements Supplier<ResponseWrapper<JokeDto>> {
public final class RandomJokeSupplier {
private final ICNDBApi icndbApi;
......@@ -20,7 +20,6 @@ public final class RandomJokeSupplier implements Supplier<ResponseWrapper<JokeDt
icndbApi = ICNDBService.getInstance();
}
@Override
public ResponseWrapper<JokeDto> get() {
/* TODO fetch a random joke synchronously
* if an exception occurs return null */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment