What do you want to save?
Add Code snippet
New code examples
-
Java 2021-10-12 09:16:13
Java StringBuilder filter same lines
Set<String> tokens = new HashSet<String>(Arrays.asList(s.split("\n"))); StringBuilder resultBuilder = new StringBuilder(); boolean first = true; for(String token : tokens) { if(first) first = false; else resultBuilder.append... Add solution -
Java 2021-10-11 12:15:02
convert hashset to int array java
import java.util.Arrays; import java.util.Set; import java.util.HashSet; class Main { // Program to convert set of integer to array of int in Java public static void main(String args[]) &nb... Add solution -
Java 2021-10-09 08:22:14
how to set two different table admin and user for separate jwt token in spring boot
private Set getAuthority(User user) { Set authorities = new HashSet<>(); user.getRoles().forEach(role -> { authorities.add(new SimpleGrantedAuthority("ROLE_" + role.getName())); }); return authorities; } Add solution -
Other 2021-10-06 08:14:04
first repeating character in a string
// C# program to find the first // repeated character in a string using System; using System.Collections.Generic; class GFG { // This function prints the first // repeated character in str[] public static char firstRepeating(char[] str) { &nb... Add solution -
Java 2021-10-06 05:10:02
string frequency of characters in java
+++METHOD WITH NONDUP+++ public static String FrequencyOfChars(String str) { String nonDup = ""; for(int i=0; i < str.length(); i++) if(!nonDup.contains(""+str.charAt(i))) nonDup+= ""+str.charAt(i); String expectedRe... Add solution -
Java 2021-10-05 21:26:04
set to list java
Set<Foo> foo = new HashSet<Foo>(myList); Add solution -
Other 2021-10-05 03:28:07
when to use set
When to use List, Set and Map? If we need to access elements frequently by using index, then List is a way to go ArrayList provides faster access if we know index. If we want to store elements and want them to maintain an order, then go for List again. ... Add solution