What does “|=” mean? (pipe equal operator)
I tried searching using Google Search and Stack Overflow, but it didn't show up any results. I have seen this in open source library code:
Notification notification = new Notification(icon, tickerText, when);
notification.defaults |= Notification.DEFAULT_SOUND;
notification.defaults |= Notification.DEFAULT_VIBRATE;
What does "|=" ( pipe equal operator ) mean?
It's a shortening for this:
notification.defaults = notification.defaults | Notification.DEFAULT_SOUND;
And | is a bitwise OR.