liveBook · Manning

Bag

A bag, or multiset, is an unordered collection that permits duplicate elements and preserves their multiplicities.

How 2 Manning books explain it

Grokking Data Structures

Bag is the book's class that wraps an underlying linked list and exposes operations for inserting and traversing bag elements.

How it is used
Collects elements for tasks such as counting totals or categories when processing order does not matter.
How deep it goes
Defines the two-operation interface and shows a Python linked-list wrapper, without requiring a particular iteration order.
Examples
Uses marbles to show insertion, traversal, and counts that remain valid despite a change in iteration order.
What you can do after
Build it from scratch as a Python class backed by a singly linked list, with insertion and traversal methods.

Read how Grokking Data Structures explains bag →

Java Persistence with Spring Data and Hibernate epub

A persistent unordered collection that permits duplicate element values and does not assign a collection index to them.

How it is used
Maps unordered persistent collections whose duplicate values are meaningful or whose one-to-many insertion path should avoid loading existing elements.
How deep it goes
Explains Java mappings, surrogate collection keys, duplicate handling, lazy insertion, and multiple-bag fetch limits.
Examples
Uses bags of strings, embeddable images, and bidirectional Item-to-Bid associations with duplicate-addition and SQL-loading tests.
What you can do after
Apply it via Hibernate annotations to map duplicate-capable collections and assess their loading, fetching, and schema consequences.

Read how Java Persistence with Spring Data and Hibernate epub explains bag →

Also covered in

What to know first

Related concepts

Questions about bag

What is bag?

A bag, or multiset, is an unordered collection that permits duplicate elements and preserves their multiplicities.

Which Manning books explain bag?

Grokking Data Structures and Java Persistence with Spring Data and Hibernate epub.

What should I know before learning bag?

Manning books that teach bag usually introduce vector first.

What is the difference between bag and Java Collections Framework?

A bag, or multiset, is an unordered collection that permits duplicate elements and preserves their multiplicities. The Java Collections Framework is Java’s standard library framework of interfaces, implementations, and algorithms for representing and manipulating collections of objects.

What is bag a kind of?

Bag is a kind of abstract data type. An abstract data type specifies values, operations, and behavior independently of a particular representation or implementation.

What are the parts of bag?

Bag includes insert method and iterate method.

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.