From the Super Mario Wiki
Mario can buy a Li'l Oink egg for 10 Coins. By hitting the egg with his Hammer, the egg will hatch into a random Li'l Oink. Mario can have up to ten Li'l Oinks in the Li'l Oink pen, but the moment the 11th is hatched, the first Li'l Oink will run away, leaving behind an item. If Mario chooses to collect this item by entering the pen, however, all the Li'l Oinks will get scared and run away. Mario can, however, ignore the item to keep his Li'l Oinks. The Li'l Oinks will leave in the same order they were hatched, so if, for example, Mario wants the item held by the second Li'l Oink, he will need to hatch twelve eggs. If he wants the item held by the third one hatched, thirteen eggs are needed, and so on. If Mario is very quick, he can collect two consecutive Li'l Oinks' items by quickly releasing two more into the pen, then rushing to collect the first item released as it flashes before disappearing. The second item will then still be in the pen to be collected.
If the player is fast enough, it is entirely possible to collect three items in a row, as the spin dash can make it possible using the same method as shown above. The player must collect the first item as it is flashing, the second item as it starts to flash, and the third item before it flashes.
There are ten varieties of Li'l Oinks, and each one holds a different item.
In order of rarity, this table lists the items obtainable from the Li'l Oinks.
Super Smash Bros. for Wii U Trophy