When we say “Java collections”, we actually can mean two things. In a general sense, we talk about implementations of common data structures, like array-based lists, sets, queues, maps, vectors etc. In a more narrow understanding, we describe concrete abstractions and implementations, which together make Java Collections Framework. This is a set of most widely used data structures and corresponding algorithms (like sorting, searching or filtering), which inherit the root java.util.Collection interface.

This book is aimed to beginner and intermediate level Java software engineers. It covers root Collection interface, as well its concrete implementations, such as lists, sets and queues. Separate chapters focus on maps, streams and testing Java collections with AssertJ library.

Contents

  • Overview of java.util.Collection
    • Which data structures are collections
    • Insert elements into a collection
    • Removing elements from a collection
    • Create streams
    • Iterating patterns
    • Access individual elements
    • Non-optional methods
  • Using streams
    • Initialize streams
    • A concept of pipeline
    • Intermediate operations
    • Terminal operations
  • Lists
    • What is an array based list?
    • Add elements
    • Remove elements
    • Access elements
    • Sub lists
    • Search
    • Filtering
    • Replace an element
    • Compare lists
  • Sets
    • Mathematical definition of sets
    • Add elements
    • Remove elements
    • Replace elements
    • Get an arbitrary element approaches
    • Set size
    • Sub sets
  • Queues
    • FIFO vs LIFO
    • Create queues
    • Enqueue
    • Dequeue
    • Access head element
    • Tail elements
    • ArrayDeque in Java
  • Maps
    • Map as a data structure
    • Insert elements
    • Access elements
    • Delete elements
    • Replace elements
  • Fluent assertions with AssertJ
    • Collection contains element
    • Collection contains elements in any order
    • Collection contains elements in exact order
    • Collection contains no duplicates
    • Collection contains element only once

How to buy

You can buy this book on Smashwords.com

  • Book will be available in your Smashwords library account
  • Download in epub, mobi or pdf formats