Java examples
java-arrays
- Calculate average of array
- Convert collection to array
- Find element in array
- Find element index in array
- Initialize array
- Join two arrays
- Max value in array
- Min value in array
- Print array
- Remove element from array
- Remove last element from array
- Reverse elements in array
- Shift values in array
- Sort array
- Sum values in array
java-collections
- Average of list
- Cartesian product
- Convert Iterator to ArrayList
- Convert array to list
- Convert array to set in java
- Convert list to map
- Convert properties to map
- Count booleans in list
- Count non empty strings
- Count number of keys or values in hashmap
- Count occurrences in list
- Difference of two sets
- Distinct elements in collection
- Filter a collection
- Filter collection by class type
- Filter map by entries
- Filter map by key
- Filter map by value
- Filter null from collection
- Find element in list
- Find first non null
- Find longest length string in list
- Find max value in HashMap
- Find min value in HashMap
- Find shortest length string in list
- Frequency of object in collection
- Get first element in list
- Get last element in list
- Initialize list
- Initialize map
- Initialize set
- Intersection of two sets
- Is list sorted
- Iterate or loop over each entry in map
- Join two lists
- List contains all elements
- List contains any element
- Max value in list
- Min value in list
- Print list
- Remove element from list
- Remove empty arraylist from list
- Remove last element in arraylist
- Retrieve random value from Array List
- Return empty enumeration
- Return empty iterator
- Return empty list
- Return empty list iterator
- Return empty map
- Return empty set
- Return empty sorted map
- Return empty sorted set
- Reverse elements in list
- Reverse map lookup - How to get key from value?
- Shuffle elements in list
- Sort a list
- Sort map by key
- Sort map by value
- Split / Partition a list
- Square values in array list
- Sum first N values in list
- Sum values in list
- Symmetric difference of two sets
- Take N elements from list
- Union of two sets
java-date
- 90 Day Weekend Adjuster
- Add days to date
- Add hours to date
- Add milliseconds to date
- Add minutes to date
- Add months to date
- Add seconds to date
- Add weeks to date
- Add years to date
- Calculate elapsed time
- Calculate leap year
- Calculate time difference
- Company holiday query
- Compare dates
- Convert string to java.sql.Timestamp
- Current Quarter
- Current Quarter w/Guava
- Current quarter query
- Date to XMLGregorianCalendar
- Daylight saving query
- Days between two dates
- Days in month
- First day of quarter adjuster
- First day of year
- Format date
- Generate random date
- Get day of week
- Hours between two dates
- How to subtract seconds from date
- Hurricane season query
- Julian calendar
- Last day of quarter adjuster
- Market day query
- Minutes between two dates
- Months between two dates
- Next holiday adjuster
- Parse date
- Predefined date formats
- Predefined month adjusters
- Predefined year adjusters
- Seconds between two dates
- Subtract days from date
- Subtract hours from date
- Subtract milliseconds from date
- Subtract minutes from date
- Subtract months from date
- Subtract weeks from date
- Subtract years from date
- Truncate time
- Weekend query
- Weeks between two dates
- Work day query
- Years between two dates
java-general
java-guava
- BiMap example
- Booleans utility example
- Charmatcher example
- ClassToInstanceMap example
- Collections2 utility example
- Converter example
- Enums example
- FluentIterable example
- Functions example
- Iterables example
- Joiner example
- Lists utility example
- Map difference example
- Maps utility example
- Multimap example
- Multiset example
- Objects example
- Ordering example
- Predicates example
- RangeMap example
- Splitter example
- Strings utility example
- Table example
- java.util.Optional example
java-hamcrest
java-html
java-io
- Append text to file
- Change last modified date
- Check if file exists
- Check if file is hidden
- Copy file
- Count total number of lines in text file
- Count words in file
- Delete a file
- File to byte array
- Filter files by extension
- Get available space
- Get file creation date
- Get file extension
- Get file last accessed time
- Get file last modified time
- Get file name w/o extension
- Get file size
- How to get total space on disk
- How to get used space on disk
- InputStream to String
- Is file a directory
- Is file a normal file
- Is file a symbolic link
- Is file other
- Read CSV file
- Read file into arraylist
- Read file into string
- Read keyboard input
- Read text file
- String to InputStream
- Transform text file to objects
- Write byte array to file
- Write to file
java-json
java-junit
java-net
java-number
java-regex
java-string
- Capitalize first word
- Capitalize words in sentence
- Center justify string
- Check if string is null or empty
- Common prefix between strings
- Common suffix between strings
- Compare strings
- Concatenate strings
- Convert ASCII char to string
- Convert map to string
- Count consonants in string
- Count lower case letters
- Count number of letters in string
- Count number of words in string
- Count occurrences of digit in string
- Count upper case letters
- Count vowels in string
- Divide on words and length
- Format phone number
- Generate random vowel
- Group and count chars in a string
- How to check if a string ends with a char
- How to trim a String
- Join strings
- Join strings with comma
- Join strings with hyphen
- Left pad string
- Left trim string
- Message formatting
- Parse phone number
- Parse zip code
- Remove character from string
- Remove first character from string
- Remove last character from string
- Remove newline from string
- Remove whitespace from string
- Repeat string
- Replace char within a string
- Reverse string
- Right pad string
- Right trim string
- Split string
- Split string by colon
- Split string by comma
- Split string on whitespace
- String starts with
java-stream
- Build a stream
- Concatenate java 8 stream
- Convert stream to List
- Convert stream to Map
- Convert stream to Set
- Convert stream to String
- Convert stream to array
- Convert string to stream
- DoubleStream example
- Find last element of java 8 stream
- IntStream example
- LongStream example
- Numeric Ranges Example
- Stream filter and slice
- Stream find and match
- Stream groupingBy
- Stream intermediate operations
- Stream terminal operations
- Sum unique values of numeric streams
- java.util.Stream reduce
java-util
- Decode base64 string
- Decode base64 url
- DoubleSummaryStatistics Example
- Encode string to base64
- Encode url base64
- IntSummaryStatistics Example
- Java 8 Optional Example
- Java 8 function example
- LongSummaryStatistics Example
- Objects Example
- OptionalDouble Example
- OptionalInt Example
- OptionalLong Example
- Read properties file
- Regular expression split on each char
- String Joiner example
- java.util.function.Predicate example