Walmart Store are private property and those dumpsters at Walmart and any other stores are also private dumpsters and private property.
So it can be illegal to dumpster dive at Walmart if they don't want you to dig through the dumpsters.
Some Walmart stores may call the police on you or warn you at least to stay out of the dumpster and if you don't obey them then you can get arrested or ticketed.
However some Walmart do not mind you taking things from the dumpster.
But then again some Walmart Stores I've seen have compactors that make it dangerous to dumpster dive in their dumpsters.
And it also renders the stuff basically useless.
If the trash can or trash is out on public property such as at a park, or set out by the curb then it's not considered stealing to take things from the garbage or trash.
Trash cans and trash that is on private property can be considered stealing so if there are dumpsters or trash cans on private property then you cannot enter the private property to go through the garbage.
But if the dumpster or trash can or trash is out on the curb or on public property then going through the trash and taking things set out for trash is not illegal.
The trash or garbage that has been put out on the curb for pickup by the garbage men is public property.
So if you put something out by the curb for garbage then anyone who comes by can actually take that said item or items.
When you put something out by the curb as garbage it is now no longer in your possession and you've given up the ownership rights to whatever it is you've set out by the curb.
Once something is put out for garbage it's public property and in the public domain and anyone can come and get it.
So if you don't want to give up the item then don't put it out by the curb.
Also any garbage in garbage cans that are set out on the curb for trash pickup becomes available legally for anyone to dig through.
So whether you like it or not people can legally dig in your garbage cans once they are out by the curb.