AWGRead

Monday, May 20, 2019

Replacing null checks

This article introduces some patterns for replacing the "old" null-check pattern.

I.e. instead of:
if (value != null) { doSomething(value); } 
do:
Optional maybeValue = Optional.ofNullable(value); if (maybeValue.isPresent()) { doSomething(maybeValue.get()); }
Posted by S931Coder at 8:14 AM No comments:
Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Newer Posts Older Posts Home
Subscribe to: Posts (Atom)

Links

  • AWGtek

Blog Archive

  • ▼  2019 (2)
    • ▼  May (1)
      • Replacing null checks
    • ►  February (1)
  • ►  2017 (1)
    • ►  March (1)
  • ►  2016 (6)
    • ►  October (1)
    • ►  July (4)
    • ►  January (1)
  • ►  2015 (1)
    • ►  March (1)
  • ►  2014 (4)
    • ►  October (1)
    • ►  September (1)
    • ►  May (1)
    • ►  March (1)
  • ►  2013 (6)
    • ►  November (1)
    • ►  September (1)
    • ►  July (1)
    • ►  May (3)
  • ►  2012 (4)
    • ►  September (2)
    • ►  July (2)

Labels

Anti-patterns Architecture Business Logic C ColdFusion ColdSpring Database DI Idioms Java Java EE OOP Programming Languages Ruby Rules-engines Singleton Unit Testing XML XSS

About Me

S931Coder
Documenting my journey through the world of IT.
View my complete profile
Travel theme. Powered by Blogger.