Top Tweets for #WeeklyJavaTips
βοΈ #WeeklyJavaTips
Inheritance is a mechanism that allows a class to inherit properties and behaviors from another class. It provides code reuse and relationships between super class & subclasses.
You can find a simple example in the below post how inheritance works in #Javaππ»
@therealdanvega @0xfsk class TShirt {
private String color;
public TShirt(String color) {β¦}
β¦
}
class Polo extends TShirt {
private boolean hasCollar;
public Polo(String color, boolean hasCollar) {
super(color);
this.hasCollar = hasCollar;
}
β¦
}
Clone Objects in #Java;
Object class provides clone() method to create a copy of an object.
- Swallow Copy β‘οΈ Changes are reflected, object are not 100% disjoint
- Deep Copy β‘οΈ Changes are not reflected, object are 100% disjoint
https://t.co/GqHc6M58se
#WeeklyJavaTips

If you upgrade to #SpringBoot version 3.0.x from 2.6.x or 2.7.x and if you are using Spring Cloud, do not forget to update your Spring Cloud version.
Details can be found;
https://t.co/akwZUDEm0o
#WeeklyJavaTips
Example error for not having this update is in the photo.

Vector Class in #Java;
The Vector class implements a growable array of objects which means that it can dynamically grows & shrinks.
As Vector class implements the List interface, all methods of List interface can be used.
Example code;
https://t.co/MNGiG0dbsb
#WeeklyJavaTips

IntStream Interface in #Java;
IntStream is a primitive int specialization of Stream Interface. IntStream interface is a stream of primitive int elements providing sequential and parallel aggregate functions.
https://t.co/9fOMvdx22l
#WeeklyJavaTips #IntStreamInterface
@0xfcode Simdi gordum de, benim #Java cozumunu vereyim. Aranmak istenen rakam, interval i da parametric aliyor. Daha derli halini de github repoma IntStream interface olarak ekledim.
#WeeklyJavaTips olarak yayinlayacagim IntStream interface olarak.

Sealed Classes in #Java;
Sealed classes/interfaces in Java are used to restrict which classes may extend or implement them.
For the sample code, please check my below #Java examples #GitHub repository;
https://t.co/VXc2g9BwwN
#WeeklyJavaTips #SoftwareDevelopment

Streaming vs Looping in #Java βοΈ;
* Performance -> Loop is better in memory & speed. But, for huge lists, parallelStream may be better (be careful while using itβΌοΈ)
* Readability --> Streams are more readable then loops and more fancy π
https://t.co/udQeAPRqaZ
#WeeklyJavaTips

BigDecimal Class in #Java;
BigDecimal class provides operation for arithmetic, comparison, hashing, rounding, manipulation & format conversion. It is useful to use it in domains dealing with precise operations like fintech, e-commerce.
https://t.co/5gefEACIve
#WeeklyJavaTips

Implementing this week #WeeklyJavaTips by just looking down over the Camel Beach with my cup of #Java & with my #Java example code base openβΌοΈ
This photo is especially for you @Sharat_Chander, my friend βοΈπ»βοΈππ―ππ»

Pattern Matching for Switch in #Java;
Pattern matching is to recognize a specific type. It can be done with instanceof operator but can be done switch with #Java17.
For me, using switch is makes code more readable.
Check my sample code;
https://t.co/UlYbAWyQoK
#WeeklyJavaTips

Threads in #Java;
Threads perform multi-tasking at the same time without interrupting the main application.
Threads can be initialized by;
* Implementing Runnable Interface
* Extending Thread Class (also implements Runnable Interface)
https://t.co/dWt65ZgEhu
#WeeklyJavaTips
Function Interface in #Java;
Implements functional programming in #Java, takes one input and produce result.
* apply() -> apply the func to the given arg
* andThen() -> input func will be executed after
* compose() -> reverse of andThen()
https://t.co/3EinFwJbNy
#WeeklyJavaTips
List vs Set in #Java;
List is an indexed seq that allows duplicate values and can store multiple null values.
Set is a non-indexed seq that does not allow duplicate values and can store only one null value.
How to convert List to Set;
https://t.co/5O4YoaYx8U
#WeeklyJavaTips
Just added an example of implementing recursion in #Java to my java-examples repo on #GitHub.
The example is from @hackerrank 30-days of code question, BST Level-Order Traversal.
#SoftwareDevelopment #CodeKata #OpenSource #WeeklyJavaTips
https://t.co/chX1sh96xR
π’π’π’
Add a file named https://t.co/Ims2mdM25T under your project's root folder in order to install with the required #JDK version within #Heroku.
The content of the file will be as in the attached code snippet in order to use #Java17.
#WeeklyJavaTips #Java

Dependency tree is crucial in a software project in order to take required actions before dependency conflicts, especially with dependency versions.
For #Gradle; gradle dependencies
For #Maven; mvn dependency:tree
#SoftwareDevelopmentWeeklyTips #WeeklyJavaTips

To apply multiple predicates to Stream API filter() method;
Predicates list can be reduced to a single predicate with or/and logics between each predicate to be applied to #Java #StreamAPI filter() method.
The example in my #Github repo; https://t.co/FcrsRsrpce
#WeeklyJavaTips

How to generate random integers with #Java;
RandomGeneratorFactory (released within #Java17) is factory class in order to handle generating random integers by using Pseudorandom number generator (PRNG) algorithms.
My #GitHub repo: https://t.co/FcrsRsrpce
#WeeklyJavaTips

parallelStream().forEach() vs forEach()
The execution order cannot be predicted for the first one but the execution order is same with the insertion order for the second one.
These should be selected from this perspective while using.
#WeeklyJavaTips #Java #SoftwareDevelopment

Last Seen Hashtags on Sotwe
Trends for you
Most Popular Users

Elon Musk 
@elonmusk
240.1M followers

Barack Obama 
@barackobama
119.3M followers

Donald J. Trump 
@realdonaldtrump
111.6M followers

Cristiano Ronaldo 
@cristiano
108.9M followers

Narendra Modi 
@narendramodi
107M followers

Rihanna 
@rihanna
97.3M followers

NASA 
@nasa
92.1M followers

Justin Bieber 
@justinbieber
90.6M followers

KATY PERRY 
@katyperry
86.8M followers

Taylor Swift 
@taylorswift13
80.6M followers

Lady Gaga 
@ladygaga
72.1M followers

Kim Kardashian 
@kimkardashian
69.4M followers

YouTube 
@youtube
68.6M followers

Virat Kohli 
@imvkohli
68.5M followers

Bill Gates 
@billgates
63.4M followers

The Ellen Show
@theellenshow
62.5M followers

CNN 
@cnn
61.9M followers

Neymar Jr 
@neymarjr
61M followers

X 
@x
60.9M followers

CNN Breaking News 
@cnnbrk
59.9M followers

