Skip to Content
Java By Comparison
book

Java By Comparison

by Simon Harrer, Linus Dietz, Jörg Lenhard
March 2018
Intermediate to advanced
208 pages
4h 52m
English
Pragmatic Bookshelf
Content preview from Java By Comparison

Document Using Examples

 class​ Supply {
 
 /**
  * The code universally identifies a supply.
  *
» * It follows a strict format, beginning with an S (for supply), followed
  * by a five digit inventory number. Next comes a backslash that
  * separates the country code from the preceding inventory number. This
  * country code must be exactly two capital letters standing for one of
  * the participating nations (US, EU, RU, CN). After that follows a dot
  * and the actual name of the supply in lowercase letters.
  */
 static​ ​final​ Pattern CODE =
  Pattern.compile(​"^S\\d{5}\\\\(US|EU|RU|CN)\\.[a-z]+$"​);
 }

Some programming constructs are very powerful, but also very complex. Regular expressions fall into this category. ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Java 8 in Action

Java 8 in Action

Mario Fusco, Alan Mycroft, Raoul-Gabriel Urma
Java 8 Lambdas

Java 8 Lambdas

Richard Warburton
Think Java, 2nd Edition

Think Java, 2nd Edition

Allen B. Downey, Chris Mayfield
Modern Java in Action

Modern Java in Action

Raoul-Gabriel Urma, Mario Fusco, Alan Mycroft

Publisher Resources

ISBN: 9781680505887Errata Page