Programming TIPS!
A site on Java API Examples and TIPS.
Java TIPS
- Don't use the legacy File class, use new I/O APIs instead (August 14, 2024)
- Delete a directory with contents (August 8, 2024)
- How to Use the Simple Web Server (jwebserver) (July 10, 2024)
- Get the current time (October 11, 2023)
- Use TimeUnit.sleep instead of Thread.sleep (July 1, 2023)
- Simple Builder Design Pattern (July 1, 2023)
- Basics of Record class (June 10, 2023)
- An exhaustive list of format strings (May 20, 2023)
- Basics of Date and Time (May 13, 2023)
- Don't use the legacy Date and Calendar classes, use new APIs instead (May 13, 2023)
- Use System.nanoTime to measure elapsed time (May 13, 2023)
Category
Annotation
Base
- API Examples
Buffer
- API Examples
Channel
- API Examples
Checksum
Collection
- API Examples
Database(JDBC)
- API Examples
Design
Exception
- API Examples
- Error
- Exception
- RuntimeException
- ArithmeticException
- ArrayIndexOutOfBoundsException
- ArrayStoreException
- CancellationException
- ClassCastException
- ConcurrentModificationException
- DateTimeException
- DateTimeParseException
- IllegalArgumentException
- IllegalStateException
- IndexOutOfBoundsException
- NoSuchElementException
- NullPointerException
- PatternSyntaxException
- StringIndexOutOfBoundsException
- UnsupportedOperationException
- Throwable
File
- API Examples
Functional Interface
- API Examples
Internationalization
- API Examples
IO
- API Examples
Logging
Network
- API Examples
Number
- API Examples
Optional
- API Examples
Process
- API Examples
Random
- API Examples
Reactive Streams
- API Examples
Reference
- API Examples
Reflection
- API Examples
Regex
- API Examples
Stream
- API Examples
String
- API Examples
Thread
- API Examples
- BlockingQueue
- Callable
- CancellationException
- ConcurrentHashMap.KeySetView
- ConcurrentLinkedDeque
- ConcurrentLinkedQueue
- ConcurrentMap
- ConcurrentModificationException
- ConcurrentSkipListSet
- Condition
- CopyOnWriteArrayList
- CopyOnWriteArraySet
- CountDownLatch
- CyclicBarrier
- Exchanger
- Executor
- ExecutorService
- Executors
- Future
- Future.State
- FutureTask
- InterruptedException
- Lock
- Runnable
- Semaphore
- Thread
- ThreadGroup
- ThreadLocal
- TimeUnit
Time
- Get the current time
- Basics of Date and Time
- Don't use the legacy Date and Calendar classes, use new APIs instead
- API Examples
- Calendar
- ChronoLocalDate
- ChronoLocalDateTime
- ChronoZonedDateTime
- Clock
- Date
- DateTimeException
- DateTimeParseException
- DayOfWeek
- Duration
- Era
- Instant
- InstantSource
- JapaneseDate
- LocalDate
- LocalDateTime
- LocalTime
- Month
- MonthDay
- OffsetDateTime
- OffsetTime
- Period
- Temporal
- TemporalAccessor
- TemporalAdjuster
- TemporalAdjusters
- TimeZone
- Year
- YearMonth
- ZonedDateTime
- ZoneId
- ZoneOffset
Tool
- API Examples
Utility
- API Examples
XML
- API Examples
ZIP
Index
- @
- @FunctionalInterface (annotation) (September 29, 2023)
- @Override (annotation) (September 26, 2023)
- @SafeVarargs (annotation) (October 9, 2023)
- @SuppressWarnings (annotation) (October 18, 2023)
- A
- AbstractCollection (February 10, 2024)
- AbstractInterruptibleChannel (November 7, 2024)
- AbstractList (February 10, 2024)
- AbstractMap (February 17, 2024)
- AbstractMap.SimpleEntry (November 23, 2023)
- AbstractMap.SimpleImmutableEntry (November 28, 2023)
- AbstractQueue (June 17, 2023)
- AbstractSequentialList (February 10, 2024)
- AbstractSet (February 17, 2024)
- AccessibleObject (July 8, 2023)
- Adler32 (July 22, 2023)
- AnnotatedElement (September 24, 2023)
- Appendable (February 11, 2024)
- ArithmeticException (May 27, 2023)
- ArrayBlockingQueue (June 30, 2023)
- ArrayDeque (February 25, 2024)
- ArrayIndexOutOfBoundsException (April 15, 2024)
- ArrayList (February 10, 2024)
- Arrays (April 8, 2023)
- ArrayStoreException (October 5, 2023)
- Attr (XML) (September 4, 2024)
- AutoCloseable (April 27, 2024)
- B
- Base64 (December 10, 2023)
- Base64.Decoder (December 10, 2023)
- Base64.Encoder (December 10, 2023)
- BaseStream (February 14, 2024)
- BiConsumer (July 1, 2023)
- BiFunction (July 1, 2023)
- BigDecimal (December 31, 2023)
- BigInteger (December 31, 2023)
- BiPredicate (July 1, 2023)
- BlockingDeque (July 5, 2023)
- BlockingQueue (July 20, 2023)
- Boolean (February 25, 2024)
- BooleanSupplier (May 15, 2024)
- Buffer (November 14, 2024)
- BufferedInputStream (July 27, 2024)
- BufferedOutputStream (July 27, 2024)
- BufferedReader (July 28, 2024)
- BufferedWriter (July 28, 2024)
- Byte (February 25, 2024)
- ByteArrayInputStream (July 23, 2024)
- ByteArrayOutputStream (July 23, 2024)
- ByteBuffer (November 19, 2024)
- ByteChannel (August 17, 2023)
- C
- Calendar (June 29, 2024)
- Callable (January 27, 2024)
- CancellationException (May 31, 2023)
- Channel (November 7, 2024)
- Character (October 3, 2024)
- CharacterData (XML) (September 4, 2024)
- CharBuffer (November 19, 2024)
- CharSequence (October 2, 2024)
- Charset (October 6, 2024)
- Checksum (July 22, 2023)
- ChoiceFormat (November 25, 2022)
- ChronoLocalDate (May 12, 2024)
- ChronoLocalDateTime (June 3, 2024)
- ChronoZonedDateTime (June 8, 2024)
- Class (July 8, 2023)
- ClassCastException (May 27, 2023)
- ClassNotFoundException (March 13, 2024)
- Cleaner (July 1, 2023)
- Cleaner.Cleanable (January 18, 2024)
- Clock (July 7, 2024)
- Cloneable (January 20, 2024)
- CloneNotSupportedException (June 10, 2023)
- Closeable (July 20, 2024)
- Collection (February 3, 2024)
- Collections (December 24, 2023)
- Collectors (July 1, 2023)
- Comment (XML) (September 7, 2024)
- CompactNumberFormat (November 27, 2022)
- Comparable (May 1, 2024)
- Comparator (May 2, 2024)
- ConcurrentHashMap (June 17, 2023)
- ConcurrentHashMap.KeySetView (June 12, 2023)
- ConcurrentLinkedDeque (June 23, 2023)
- ConcurrentLinkedQueue (June 21, 2023)
- ConcurrentMap (June 2, 2023)
- ConcurrentModificationException (May 27, 2023)
- ConcurrentSkipListMap (June 17, 2023)
- ConcurrentSkipListSet (June 17, 2023)
- Condition (May 16, 2023)
- Connection (JDBC) (August 2, 2024)
- ConsoleHandler (logging) (December 31, 2023)
- Constructor (reflection) (July 8, 2023)
- Consumer (May 29, 2024)
- CopyOnWriteArrayList (May 25, 2023)
- CopyOnWriteArraySet (June 17, 2023)
- CountDownLatch (October 12, 2022)
- CRC32 (July 22, 2023)
- CRC32C (July 22, 2023)
- Currency (December 1, 2022)
- CyclicBarrier (April 26, 2023)
- D
- DataInput (July 24, 2024)
- DataInputStream (August 13, 2024)
- DataOutput (July 24, 2024)
- DataOutputStream (August 13, 2024)
- Date (June 29, 2024)
- DateTimeException (May 11, 2024)
- DateTimeParseException (July 18, 2024)
- DayOfWeek (May 8, 2024)
- DecimalFormat (November 30, 2022)
- Deflater (ZIP) (February 14, 2023)
- DeflaterInputStream (ZIP) (July 15, 2023)
- DeflaterOutputStream (ZIP) (July 20, 2023)
- Deque (February 10, 2024)
- DirectoryNotEmptyException (November 12, 2024)
- Document (XML) (September 7, 2024)
- DocumentBuilder (XML) (September 21, 2024)
- DocumentBuilderFactory (XML) (September 21, 2024)
- DOMImplementation (XML) (September 24, 2024)
- DOMImplementationLS (XML) (September 24, 2024)
- Double (December 31, 2023)
- DoubleBuffer (November 27, 2024) Update!
- DoubleConsumer (March 19, 2024)
- DoubleFunction (February 19, 2024)
- DoublePredicate (May 6, 2024)
- DoubleStream (February 21, 2024)
- DoubleSupplier (June 12, 2024)
- Driver (JDBC) (August 22, 2024)
- DriverManager (JDBC) (August 22, 2024)
- Duration (June 1, 2024)
- E
- Element (XML) (September 11, 2024)
- Entity (XML) (September 12, 2024)
- EntityReference (XML) (September 12, 2024)
- Enum (November 6, 2024)
- EnumMap (November 17, 2023)
- Era (July 11, 2024)
- Error (March 6, 2024)
- Exception (October 31, 2024)
- Exchanger (April 28, 2023)
- Executable (July 8, 2023)
- Executor (December 24, 2023)
- Executors (December 24, 2023)
- ExecutorService (December 24, 2023)
- F
- Field (reflection) (July 8, 2023)
- File (October 30, 2024)
- FileAlreadyExistsException (November 13, 2024)
- FileChannel (November 14, 2024)
- FileHandler (logging) (December 31, 2023)
- FileLock (October 30, 2024)
- Files (November 14, 2024)
- FileStore (Storage) (November 5, 2024)
- FileSystemException (November 6, 2024)
- FileVisitor (November 5, 2024)
- FilterInputStream (July 25, 2024)
- FilterOutputStream (July 25, 2024)
- FilterReader (August 18, 2024)
- FilterWriter (August 25, 2024)
- Float (March 9, 2024)
- FloatBuffer (November 27, 2024) Update!
- Flow (Reactive Streams) (December 5, 2023)
- Flow.Processor (Reactive Streams) (December 15, 2023)
- Flow.Publisher (Reactive Streams) (April 14, 2024)
- Flow.Subscriber (Reactive Streams) (December 5, 2023)
- Flow.Subscription (Reactive Streams) (December 7, 2023)
- Flushable (July 30, 2024)
- Format (November 21, 2022)
- Formatter (logging) (December 31, 2023)
- Formatter (String Syntax) (October 3, 2024)
- Function (May 26, 2024)
- Future (December 24, 2023)
- Future.State (May 27, 2023)
- FutureTask (December 24, 2023)
- G
- GatheringByteChannel (September 13, 2023)
- GZIPInputStream (ZIP) (July 15, 2023)
- GZIPOutputStream (ZIP) (July 15, 2023)
- H
- Handler (logging) (December 24, 2023)
- HashMap (February 17, 2024)
- HashSet (February 17, 2024)
- HexFormat (July 8, 2023)
- HttpClient (March 31, 2024)
- HttpClient.Version (April 10, 2024)
- HttpHeaders (April 6, 2024)
- HttpRequest (April 4, 2024)
- HttpRequest.BodyPublisher (April 17, 2024)
- HttpRequest.BodyPublishers (April 18, 2024)
- HttpRequest.Builder (April 13, 2024)
- HttpResponse (April 4, 2024)
- I
- IllegalAccessException (May 27, 2023)
- IllegalArgumentException (March 14, 2024)
- IllegalStateException (March 24, 2024)
- IndexOutOfBoundsException (March 27, 2024)
- Inflater (ZIP) (February 16, 2023)
- InflaterInputStream (ZIP) (July 15, 2023)
- InflaterOutputStream (ZIP) (July 15, 2023)
- InheritableThreadLocal (January 25, 2024)
- InputStream (July 20, 2024)
- InputStreamReader (August 10, 2024)
- Instant (May 5, 2024)
- InstantSource (July 7, 2024)
- IntBuffer (November 20, 2024) Update!
- IntConsumer (February 27, 2024)
- Integer (December 31, 2023)
- InterruptedException (March 23, 2024)
- InterruptibleChannel (July 20, 2023)
- IntFunction (January 29, 2024)
- IntPredicate (March 25, 2024)
- IntStream (February 21, 2024)
- IntSupplier (June 12, 2024)
- IOException (October 31, 2024)
- IsoEra (July 13, 2024)
- Iterable (October 22, 2024)
- Iterator (February 22, 2024)
- J
- JapaneseDate (July 18, 2024)
- JapaneseEra (July 13, 2024)
- JShell (April 1, 2023)
- L
- Level (logging) (December 24, 2023)
- LinkedBlockingDeque (July 11, 2023)
- LinkedBlockingQueue (July 6, 2023)
- LinkedHashMap (February 17, 2024)
- LinkedHashSet (February 17, 2024)
- LinkedList (February 17, 2024)
- List (January 31, 2024)
- ListIterator (February 24, 2024)
- LocalDate (May 11, 2024)
- LocalDateTime (June 8, 2024)
- Locale (November 21, 2022)
- LocalTime (May 25, 2024)
- Lock (May 10, 2023)
- Logger (logging) (December 24, 2023)
- LogManager (logging) (December 31, 2023)
- Long (March 9, 2024)
- LongBuffer (November 27, 2024) Update!
- LongConsumer (March 16, 2024)
- LongFunction (February 12, 2024)
- LongPredicate (April 2, 2024)
- LongStream (February 21, 2024)
- LongSupplier (June 18, 2024)
- LSSerializer (XML) (September 25, 2024)
- M
- Map (December 24, 2023)
- Map.Entry (November 21, 2023)
- MappedByteBuffer (November 20, 2024)
- Matcher (regex) (October 15, 2024)
- MatchResult (regex) (October 15, 2024)
- Math (June 3, 2023)
- MathContext (December 31, 2023)
- Member (July 8, 2023)
- Method (reflection) (July 8, 2023)
- Month (July 6, 2024)
- MonthDay (July 8, 2024)
- N
- NavigableMap (January 16, 2024)
- NavigableSet (January 10, 2024)
- Node (XML) (September 1, 2024)
- Normalizer (October 2, 2024)
- NoSuchElementException (February 8, 2024)
- NoSuchFieldException (May 27, 2023)
- NoSuchFileException (November 12, 2024)
- NoSuchMethodException (May 27, 2023)
- NullPointerException (March 14, 2024)
- Number (December 31, 2023)
- NumberFormat (November 27, 2022)
- O
- Object (January 20, 2024)
- Objects (February 25, 2024)
- OffsetDateTime (July 17, 2024)
- OffsetTime (July 17, 2024)
- Optional (January 31, 2024)
- OptionalDouble (February 6, 2024)
- OptionalInt (January 31, 2024)
- OptionalLong (February 2, 2024)
- OutOfMemoryError (March 7, 2024)
- OutputStream (July 20, 2024)
- OutputStreamWriter (August 10, 2024)
- P
- Path (October 22, 2024)
- Pattern (regex) (October 15, 2024)
- PatternSyntaxException (regex) (October 27, 2024)
- Period (June 1, 2024)
- PhantomReference (July 1, 2023)
- PipedReader (August 27, 2024)
- PipedWriter (August 20, 2024)
- Predicate (January 7, 2024)
- PrintStream (July 30, 2024)
- PrintWriter (August 29, 2024)
- PriorityBlockingQueue (July 27, 2023)
- PriorityQueue (July 24, 2023)
- Process (March 26, 2023)
- ProcessBuilder (May 20, 2023)
- ProcessBuilder.Redirect (March 9, 2023)
- ProcessHandle (March 26, 2023)
- ProcessHandle.Info (March 28, 2023)
- PushbackReader (August 29, 2024)
- Q
- Queue (February 10, 2024)
- R
- Random (January 13, 2024)
- RandomAccess (December 29, 2023)
- RandomGenerator (January 7, 2024)
- Readable (August 17, 2024)
- ReadableByteChannel (August 11, 2023)
- Reader (July 21, 2024)
- ReentrantLock (June 28, 2023)
- Reference (March 9, 2024)
- ReflectiveOperationException (March 12, 2024)
- RoundingMode (December 31, 2023)
- Runnable (December 16, 2023)
- Runtime (February 24, 2023)
- RuntimeException (October 28, 2024)
- S
- Scanner (July 22, 2023)
- ScatteringByteChannel (September 11, 2023)
- SeekableByteChannel (September 1, 2023)
- Semaphore (May 13, 2023)
- SequencedCollection (December 21, 2023)
- SequencedMap (December 27, 2023)
- SequencedSet (December 25, 2023)
- Serializable (December 14, 2022)
- Set (February 8, 2024)
- Short (March 9, 2024)
- ShortBuffer (November 27, 2024) Update!
- SimpleFileVisitor (November 13, 2024)
- SimpleFormatter (logging) (December 31, 2023)
- SoftReference (July 1, 2023)
- SortedMap (January 12, 2024)
- SortedSet (January 8, 2024)
- Spliterator (April 15, 2023)
- SQLException (JDBC) (June 26, 2024)
- StackOverflowError (April 8, 2024)
- StackWalker (July 8, 2023)
- StandardCharsets (October 10, 2024)
- StandardCopyOption (File) (November 6, 2024)
- Stream (February 18, 2024)
- Stream.Builder (March 9, 2024)
- StreamHandler (logging) (December 31, 2023)
- StreamTokenizer (January 27, 2023)
- StrictMath (July 15, 2023)
- String (October 9, 2024)
- StringBuffer (October 8, 2024)
- StringBuilder (October 8, 2024)
- StringIndexOutOfBoundsException (April 23, 2024)
- StringJoiner (October 10, 2024)
- StringReader (August 13, 2024)
- StringWriter (August 13, 2024)
- SubmissionPublisher (Reactive Streams) (December 19, 2023)
- Supplier (May 23, 2024)
- System (April 28, 2024)
- T
- Temporal (June 4, 2024)
- TemporalAccessor (May 12, 2024)
- TemporalAdjuster (July 16, 2024)
- TemporalAdjusters (July 13, 2024)
- Text (XML) (September 17, 2024)
- Thread (December 24, 2023)
- ThreadGroup (January 24, 2024)
- ThreadLocal (January 22, 2024)
- Throwable (October 23, 2024)
- TimeUnit (July 1, 2023)
- TimeZone (June 30, 2024)
- ToIntFunction (May 27, 2024)
- Transformer (XML) (September 25, 2024)
- TransformerFactory (XML) (September 25, 2024)
- TreeMap (February 17, 2024)
- TreeSet (February 25, 2024)
- U
- UnsupportedOperationException (January 13, 2024)
- URI (April 20, 2024)
- URISyntaxException (April 29, 2024)
- URL (April 21, 2024)
- UUID (January 7, 2024)
- W
- WeakHashMap (March 9, 2024)
- WeakReference (March 9, 2024)
- Wrapper (JDBC) (July 3, 2024)
- WritableByteChannel (August 14, 2023)
- Writer (July 21, 2024)
- X
- XMLFormatter (logging) (December 31, 2023)
- Y
- Z
- ZipEntry (February 20, 2023)
- ZipFile (February 22, 2023)
- ZipInputStream (July 15, 2023)
- ZipOutputStream (July 15, 2023)
- ZonedDateTime (June 15, 2024)
- ZoneId (June 9, 2024)
- ZoneOffset (June 16, 2024)