Java Practices
javapractices.com offers concise presentations of Java practices, tasks, and designs, illustrated with syntax-highlighted code examples. Some general-purpose references are provided, along with some source code. See below for user comments on the site.

Simplicity does not precede complexity, but follows it. - Alan Perlis, Epigrams In Programming

Constructors
Constructors in general Construct Object using class name
Copy constructors Initializing fields to 0 false null is redundant
Beware of mistaken field redeclares Constructors shouldn't call overridables
Don't pass 'this' out of a constructor Constructors shouldn't start threads
Avoid JavaBeans style of construction  
Overriding Object Methods
Implementing compareTo Implementing equals Update
Never rely on finalize Implementing hashCode Update
Implementing toString Avoid clone
Inheritance
Designing for subclassing Consider composition instead of subclassing
Overridable methods need special care Remember styles of inheritance
Assertions
Assert is for private arguments only Assertions in general
Assert use cases Force enabling of assertions
Collections
Ways of iterating Update Encapsulate collections
Use for each liberally Use interface references to Collections
Remove from a collection New Prefer Collections over older classes
Choosing the right Collection Iterate without an index
Use standard Collections  
Exceptions
Exception translation Checked versus unchecked exceptions
Pass all pertinent data to exceptions Avoid empty catch blocks
Avoid @throws in javadoc Exceptions and control flow
Use template for repeated try catch Beware of unknown root causes
Finally and catch Be specific in throws clause
Javadoc all exceptions Stack trace as String
Input Output
Buffering usually appropriate Reading and writing binary files
Copy a file Delete a directory tree New
Copy a directory tree New Reading and writing text files
Reading and writing Serializable objects Recursive file listing
Console input Always close streams
Serialization
Some classes need readResolve Implementing Serializable
Serialization and subclassing  
Threads
Data integrity first Read write locks
Perform N tasks in parallel Prefer modern libraries for concurrency
Query host for the number of processors Always shut down an ExecutorService
Handle InterruptedException Use finally to unlock
Dump thread information Remember the types of intrinsic lock
Stop threads through cooperation Document thread safety
Synchronize access to mutable fields Launch thread is just another user thread
Objects communicating across threads Avoid ThreadGroup
Thread priorities are not portable Schedule periodic tasks
Synchronized is implementation detail  
Common Practices
Compile regular expressions once Multiple return statements
Coding conventions Overloading can be tricky
Minimize ripple effects Don't declare local variables before use
Consider code generators Avoid null if possible
Separate public and private members Defensive copying
Test using main method Use enums to restrict arguments
Design by Contract Use static imports rarely
Use boxing with care Class for constants
Extra space in argument list Quote dynamic text when logging
Package by feature, not layer Try alternatives to ResourceBundle
Validation belongs in a Model Object Beware of DecimalFormat
Beware of floating point numbers Include 'from', exclude 'to'
Passwords never in clear text Fields should usually be private
Use @Override liberally Avoid raw types
Avoid basic style errors Use final liberally
Use a fake system clock Update Tag or marker interfaces
Don't use tab characters Structs are occasionally useful
Beware of Byte Order Marks Wisdom, not rules
Nest classes with care Prefer modern date classes New
Short public methods New Hide .html and .jsp New
Return Optional not null New Varargs for 1 to N New
Uncommon classes need explicit imports Beware of instanceof operator
Interface for constants Use a testing framework (JUnit)
Output parameters Do not break portability
String concatenation does not scale Know the core libraries
Validate method arguments Generating unique IDs
Naming conventions Prefer empty items to null ones
Validate state with class invariants Use javadoc liberally
Conventional name for return value Conditional compile
Construct classes from the outside in Consider immutable forms for dates
Use System.exit with care Clarifying method
Self encapsulate fields  
Servlets and JSPs
Refactor large Controllers Update Use Model View Controller framework
Always maintain HttpSessions Session scope objects often Serializable
Do not synchronize doGet, doPost JSPs should contain only presentation logic
Beware of custom cookies Repel invalid requests
Parse parameters into domain objects Thread safety in web apps
Loss of data during restart Prefer JSTL tags
Use templates to standardize layout Pre populate forms
Prevent self linking Send trouble ticket emails
Validate email addresses Forward versus redirect
A Web App Framework WEB4J Manage sessions closely
Struts seems mediocre Choose form validation style carefully
Beware of doubly escaped ampersands Use Cascading Style Sheets
Beware multilingual submit buttons Prefer UTF 8 in all layers Update
Beware of common hacks Understand details of FORM tags
Consider Controllers for redirects Reuse login page for errors
Wrap file upload requests Use extensions for fine grained security
Beware of URL rewriting Serve binary content
Version links to CSS and JS New Sessions shared across tabs New
Apply correct redirect code Minimize site response time
Web usability guidelines Emit flexible URLs
Escape special characters Update Validate generated HTML
Measure web app performance  
Common Tasks
Pattern match lines of a file Representing money
Arrays as String Logging messages
Send an email Examine bytecode
Fetch text from the web Determine if Strings are equal
Compare and sort Strings Modernize old code
Read jar version information Implement code tables
Command line operations Open file in native directory
Run in debug mode New Memory stats New
Define app name once New Copy an array
Measure application performance Recovering resources
Generate random numbers Update Internationalization
Replace a substring Clipboard copy and paste
Get size of object in memory Time execution speed
Parse text  
Common Design Patterns
Type Safe Enumerations Abstract Factory
Command objects Template method Update
Model Objects Factory methods
Plugin Factory Wrapper (Decorator)
Immutable objects Lazy initialization
Private constructor Singleton
Functional Programming
Lambdas only for simple cases New Understand the functional style New
Static import of Collectors New Annotate functional interfaces New
Prefer standard functional interfaces New Beware forEach terminals New
Swing
Look and Feel guidelines Splash screen
Standardized dialogs Verify input with regular expressions
Swing utility tasks Swing threads
Preferences dialogs Using preferences
Observers and listeners Using JavaHelp
Change theme Actions
Timers Sort table rows
Filter table rows Swing in general
Layout Managers Input dialogs
Render table cells Align menu items
A Swing App StocksMonitor Don't subclass JDialog or JFrame
Provide an uncaught exception handler Don't bury dialogs
Minimal Swing application Verify input with Model Objects
Consider JGoodies Forms for layouts Launch other applications
Databases
Keep SQL out of code Don't perform basic SQL tasks in code
Consider data layer tools Get database connection
Consider using standard SQL Encapsulate connections
Simplify database operations Use template for transactions
Business identifiers as String Consider wrapper classes for optional data
Try pseudo persistence for mock ups Data is king
Prefer PreparedStatement Remember the basics of database design
Data access objects Connection pools
Reduce database code duplication Data exception wrapping
Tools
Using Ant for build scripts Use Version Control tools
Using Tomcat for servlets New Using Maven for builds New
User Comments
"I just wanted to take a second to say that this site is really useful. It's not all that often that I come across a site that has some good design information without a bunch of boring fluff. It reminds me of reading Effective Java, which I would consider to be one of the best books I've ever picked up."
"I love this site. It's one of the best laid out and most useful sites that I've ever used. Thank you very much."
"First I have to say, what a great site. We were thinking about starting something similar inside the company, but what better news than to hear that someone has done it for us. Keep up the great work."
"I do think this site is excellent. Keep it up."
"Awesome for a beginner like me!"
"A Great Site!!! I refer to it often. I really enjoy your common sense and straight forward, flexible approach to these issues. Thanks!"
"Thanks for a great site, it really stands out from the crowd. Keep up the good work!"