Search results for: Java

class Test { public static void main(String[] args) { List<String> cities = new ArrayList<>(Arrays.asList(“New York”, “Paris”, “London”, “Monte Carlo”, “Berlin”)); cities.stream() .map(city -> city.toUpperCase()) .forEach(city -> System.out.println(city)); } } Output: NEW YORK PARIS LONDON MONTE CARLO BERLIN class Test { public static void main(String[] args) { List<String> cities = new ArrayList<>(Arrays.asList(“New York”, “Paris”, “London”, “Monte…

Read More Streams – map() operation

class Test { public static void main(String[] args) { List<Integer> integers = new ArrayList<>(Arrays.asList(1, 2, 3, 3, 4, 5, 6, 7, 7, 8, 9, 9, 10)); List<Integer> resultList = new ArrayList<>(); for (Integer integer : integers) { if (!resultList.contains(integer)) { resultList.add(integer); } } System.out.println(resultList); } } Output: [1, 2, 3, 4, 5, 6, 7, 8,…

Read More Imperative VS Declarative Programming Part 2

class Test { public static void main(String[] args) { long startTime = System.currentTimeMillis(); StringBuffer stringBuffer = new StringBuffer(“Java”); for (int i = 0; i < 8000000; i++) { stringBuffer.append(“Programming”); } System.out.println(“Time taken by StringBuffer: ” + (System.currentTimeMillis() – startTime) + “ms”); startTime = System.currentTimeMillis(); StringBuilder stringBuilder = new StringBuilder(“Java”); for (int i = 0; i…

Read More Difference between StringBuilder and StringBuffer classes

What do you want to learn today? OAuth 2 Recent Tutorials Spring Security OAuth 2 Social Logout Sergey Kargopolov Keycloak | OAuth 2 In this short tutorial, you will learn how to configure the /logout functionality in your Spring Boot Web application that uses OAuth2 Social Login. To Read More Spring Security OAuth 2 Social…

Read More OAuth 2

What do you want to learn today? Jersey & JAX-RS Recent Tutorials DTO to Entity and Entity to DTO Conversion Sergey Kargopolov Java | Jersey JAX-RS | RESTful Web Services | Spring Boot | Spring MVC Almost in every RESTful Web Service application, I have to do the DTO to Entity and then Entity to…

Read More Jersey & JAX-RS

What do you want to learn today? Spring Cloud Recent Tutorials Spring Cloud API Gateway Global Filter Example Sergey Kargopolov Spring Cloud In this tutorial, you will learn how to create a very simple Spring Cloud API Gateway Global Pre-filter and Post filter classes. Global filters are Read More The Header Predicate in Spring Cloud…

Read More Spring Cloud Tutorials

What do you want to learn today? Spring Boot Recent Tutorials Start Spring Boot App on a Random Port Number Sergey Kargopolov Spring Boot | Spring Cloud In this tutorial, you will learn how to start your Spring Boot application on a random port number. This is very helpful when you need Read More Start…

Read More Spring Boot Tutorials

This tutorial will teach you how to create a simple Spring Cloud API Gateway Global Pre-filter and Post-filter classes. Global filters are executed for every route defined in the API Gateway. The main difference between the pre-filter and post-filter classes is that the pre-filter code is executed before Spring Cloud API Gateway routes the request to a…

Read More Spring Cloud API Gateway Global Filter Example

One way to ensure that an HTTP request to a web service endpoint contains an Authorization JWT token is to configure a gateway route to require an Authorization header.  If the HTTP request does not contain an Authorization header, Spring Cloud API Gateway will not even route this request to a destination microservice. We can…

Read More The Header Predicate in Spring Cloud API Gateway

There are a few different ways of how to create an Array with default values in Swift. Below are a few Swift code examples of creating an Array. Each example creates an array with some initial values. Create an Array of Strings var appleProgrammingLanguages: [String] = [“Swift”, “Objective-C”] Thanks to Swift’s type inference, you don’t…

Read More Create an Array with Default Values in Swift

In this tutorial, we will create a small Flutter function that calls android’s Kotlin native code to read the value of the battery level. Flutter uses a flexible system that allows you to call platform-specific APIs whether available in Kotlin or Java code on Android. Flutter’s built-in platform-specific API support does not rely on code…

Read More Calling Android Native Code in Flutter