public static synchronized void setChannels(Collection<WonderPushChannel> channels) {
        if (channels == null) return;
        boolean save = false;
        try {
            Set<String> channelIdsToRemove = new HashSet<>(sChannels.keySet());
            for (WonderPushChannel channel : channels) {
                if (channel == null) continue;
                channelIdsToRemove.remove(channel.getId());
                if (_putChannel(channel)) save = true;
            }
            for (String channelId : channelIdsToRemove) {
                if (_removeChannel(channelId)) save = true;
            }
        } catch (Exception ex) {
            Log.e(WonderPush.TAG, "Unexpected error while setting channels " + channels, ex);
        } finally {
            try {
                if (save) {
                    save();
                }
            } catch (Exception ex) {
                Log.e(WonderPush.TAG, "Unexpected error while setting channels " + channels, ex);
            }
        }
    }
public static synchronized void setChannels ( Collection < WonderPushChannel > channels ) { if ( channels == null ) return ; boolean save = false ; try { Set < String > channelIdsToRemove = new HashSet < > ( sChannels . keySet ( ) ) ; for ( WonderPushChannel channel : channels ) { if ( channel == null ) continue ; channelIdsToRemove . remove ( channel . getId ( ) ) ; if ( _putChannel ( channel ) ) save = true ; } for ( String channelId : channelIdsToRemove ) { if ( _removeChannel ( channelId ) ) save = true ; } } catch ( Exception ex ) { Log . e ( WonderPush . TAG , "Unexpected error while setting channels " + channels , ex ) ; } finally { try { if ( save ) { save ( ) ; } } catch ( Exception ex ) { Log . e ( WonderPush . TAG , "Unexpected error while setting channels " + channels , ex ) ; } } }
Create, update and remove channels to match the given channels.

<p>Creates, updates and removes channels both in this class registry and in Android.</p>

<p>Any non listed, previously existing channel will be removed.</p>

@param channels The channels to create or update.
Any non listed, previously existing channel will be removed.