This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @RestController("/finder") | |
| public class SearchRestController { | |
| @Autowired | |
| private SearchService searchService; | |
| @GetMapping("/") | |
| public ResponseEntity<List<ItemDTO>> searching(@RequestParam String word) { | |
| Long start = System.currentTimeMillis(); | |
| Optional<List<ItemDTO>> results = searchService.getListBy(word); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| java -cp "starWarsWordFinder.jar;gson-2.9.0.jar" .\SearchingInStarWarsWithGson.java Luke | |
| #it prints | |
| Luke was found 1 times |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| javac -cp .\gson-2.9.0.jar -d build .\StarWarsWordFinderWithGson.java #to get .class files | |
| jar --create --file starWarsWordFinder.jar .\StarWarsWordFinderWithGson.class '.\StarWarsWordFinderWithGson$StarWarsPeople.class' | |
| '.\StarWarsWordFinderWithGson$StarWarsPerson.class' #to create the jar file |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.google.gson.Gson; | |
| import java.net.URI; | |
| import java.net.http.HttpClient; | |
| import java.net.http.HttpRequest; | |
| import java.net.http.HttpResponse; | |
| import java.util.List; | |
| public class StarWarsWordFinderWithGson { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| java -cp .\starWarsWordFinder.jar .\SearchingInStarWarsFor.java Vader | |
| #it prints | |
| Vader were found 1 times |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| java -cp .\starWarsWordFinder.jar .\SearchingInStarWarsFor.java Yoda | |
| #it prints | |
| Yoda were found 0 times |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| java -cp .\starWarsWordFinder.jar .\SearchingInStarWarsFor.java Luke | |
| #it prints | |
| Luke were found 1 times |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.google.gson.Gson; | |
| import java.net.URI; | |
| import java.net.http.HttpClient; | |
| import java.net.http.HttpRequest; | |
| import java.net.http.HttpResponse; | |
| import java.util.List; | |
| public class StarWarsWordFinder { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class SearchingInStarWarsFor { | |
| public static void main(String[] args) { | |
| if (args.length > 0) | |
| StarWarsWordFinder.searchingFor(args[0]); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import java.net.URI; | |
| import java.net.http.HttpClient; | |
| import java.net.http.HttpRequest; | |
| import java.net.http.HttpResponse; | |
| public class StarWarsWordFinder { | |
| static final String STARWARS_URL_PEOPLE_API = "https://swapi.dev/api/people"; | |
| static int foundTimes = 0; | |
NewerOlder