Ruang penulis
SEBUAH JURNAL TENTANG TEKNOLOGI

Belajar hal baru.
Tulis. Bagikan.

Ruang untuk merangkai pengetahuan, satu baris kode setiap hari.
Temukan tutorial, ide, dan catatan dari perjalanan belajar.

1914 catatan & terus bertumbuh
UNTUK RASA INGIN TAHUMU

Catatan terbaru.

APACHE COMMONS / CATATAN</>
Apache Commons20 Okt 2007

How do I check for an empty string?

package org.kodejava.commons.lang; import org.apache.commons.lang3.StringUtils; public class EmptyStringCheckDemo { public static void main(String[] args) { // Create some variable to hold some empty string, contains only // whitespaces and words. String one = ""; String two = "\t\r\n"; String three = " "; String four = null; String five = "four four two"; // We can […]

Wayan · 2 menit baca
APACHE COMMONS / CATATAN</>
Apache Commons19 Okt 2007

How do I get the nearest hour, minute, second of a date?

This example demonstrates how to use the DateUtils.round() method to get the nearest hour, minute and second of a date. package org.kodejava.commons.lang; import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateUtils; import org.apache.commons.lang3.time.FastDateFormat; import java.util.Calendar; import java.util.Date; public class DateRoundingDemo { public static void main(String[] args) { FastDateFormat formatter = DateFormatUtils.ISO_...

Wayan · 2 menit baca
APACHE COMMONS / CATATAN</>
Apache Commons19 Okt 2007

How do I format date and time using DateFormatUtils class?

The DateFormatUtils class help us to format date and time information. This class uses an instance of org.apache.commons.lang3.time.FastDateFormat class to format the date and time information. Compared to Java SimpleDateFormat, the FastDateFormat class is thread safe. If you want to create a custom date format, you can use the FastDateFormat class directly. package org.kodejava.commons.lang; import […]

Wayan · 2 menit baca
APACHE COMMONS / CATATAN</>
Apache Commons14 Okt 2007

How do I find specific elements or object in an array?

This example demonstrates how to find specific items in an array. We will use the org.apache.commons.lang3.ArrayUtils class. This class provides method called contains(Object[] array, Object objectToFind) method to check if an array contains the objectToFind in it. We can also use the indexOf(Object[] array, Object objectToFind) method and the lastIndexOf(Object[] array, Object objectToFind) method to […]

Wayan · 2 menit baca
APACHE COMMONS / CATATAN</>
Apache Commons10 Okt 2007

How do I use CompareToBuilder class?

This example show how we can use the CompareToBuilder class for automatically create an implementation of compareTo(Object o) method. Please remember, when you are implementing this method, you will also need to implement the equals(Object o) method consistently. This will make sure the behavior of your class is consistent in relation to collection sorting processes. […]

Wayan · 2 menit baca
APACHE COMMONS / CATATAN</>
Apache Commons10 Okt 2007

How do I use ReflectionToStringBuilder class?

Implementing toString() method sometimes can become a time-consuming process. If you have a class with a few fields, it might be alright. However, when you deal with a lot of fields, it will surely take some time to update this method every time a new field comes and goes. Here comes the ReflectionToStringBuilder class that […]

Wayan · 2 menit baca

Pengetahuan tumbuh ketika dibagikan.

Simpan rasa ingin tahu. Selalu ada hal baru untuk dipelajari.

Jelajahi catatan ↗
Putu Adi Guna Permana
TENTANG PENULIS

Dr (C). Ir. Putu Adi Guna Permana, S.Kom., M.Kom., IPM., ASEAN Eng.

Penulis dan pendiri Diary Coding — berbagi catatan, tutorial, dan pengalaman seputar pemrograman untuk siapa pun yang ingin terus belajar.