This file contains 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
//Buffered Image nesnesini Base64 encoded stringe dönüştürmek için | |
public static String bufferedImgToBase64String(final BufferedImage img, final String formatName) { | |
final ByteArrayOutputStream os = new ByteArrayOutputStream(); | |
try { | |
ImageIO.write(img, formatName, Base64.getEncoder().wrap(os)); | |
return os.toString(StandardCharsets.ISO_8859_1.name()); | |
} catch (final IOException ioe) { | |
throw new UncheckedIOException(ioe); | |
} | |
} |
This file contains 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 static void main(String[] args) { | |
BufferedImage qrImage = null; | |
try { | |
qrImage = createQr("https://medium.com/@mevlutsungur", 150); | |
} catch (UnsupportedEncodingException e) { | |
e.printStackTrace(); | |
} catch (WriterException e) { | |
e.printStackTrace(); | |
} | |
final String fileFormat = "PNG"; |
This file contains 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 static BufferedImage createQr(String text, Integer length) throws UnsupportedEncodingException, WriterException { | |
MultiFormatWriter writer = new MultiFormatWriter(); | |
text = new String(text.getBytes("UTF-8"),"UTF-8"); | |
BitMatrix matrix = writer.encode( text, | |
BarcodeFormat.QR_CODE, length, length); | |
BufferedImage bufferedImage = MatrixToImageWriter.toBufferedImage(matrix); | |
return bufferedImage; |
This file contains 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
<dependency> | |
<groupId>com.google.zxing</groupId> | |
<artifactId>core</artifactId> | |
<version>3.4.1</version> | |
</dependency> | |
<dependency> | |
<groupId>com.google.zxing</groupId> | |
<artifactId>javase</artifactId> | |
<version>3.4.1</version> | |
</dependency> |
This file contains 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
enum Beden { | |
SMALL,MEDIUM,LARGE | |
} |
This file contains 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 static void main(String[] args) { | |
LocalDate now = LocalDate.now(); | |
List<LocalDate> isimList = Arrays.asList(now, null, now.minusDays(2), now.plusDays(3), | |
now.minusMonths(2), null, now.plusYears(1), null); | |
isimList.sort(Comparator.nullsLast(LocalDate::compareTo)); | |
isimList.stream().forEach(System.out::println); | |
} |
This file contains 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 static void main(String[] args) { | |
List<String> isimList = Arrays.asList("Sungur",null,"Mevlüt"); | |
isimList.sort(Comparator.nullsFirst(String::compareTo)); | |
isimList.stream().forEach(System.out::println); | |
} |
This file contains 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 static void main(String[] args) { | |
List<String> isimList = Arrays.asList("Sungur",null,"Mevlüt","Angular"); | |
isimList = isimList.stream().filter(i -> i != null).sorted(String::compareTo) | |
.collect(Collectors.toList()); | |
isimList.forEach(System.out::println); | |
} |
This file contains 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 static void main(String[] args) { | |
List<String> isimList = Arrays.asList("Sungur",null,"Mevlüt","Angular"); | |
isimList.sort(String::compareTo); | |
} |
This file contains 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 static void main(String[] args) { | |
List<String> isimler = new ArrayList<>() {{ | |
add("Mevlüt"); | |
add("Sungur"); | |
add("Java"); | |
add("Angular"); | |
}}; | |
for(String s : isimler) { | |
if(s.startsWith("S")) isimler.remove(s); |
NewerOlder