Как проверить, содержатся ли элементы ArrayList все в другом ArrayList

Будет ли это работать

import airplayer = require('airplayer');

export class AirplaySharing {
    public init() {
        const list = airplayer();
        list.on('update', function(player) {
            console.log('Found new AirPlay device:', player.name);
        });
    }
}

Также было бы лучше использовать конструктор машинописи? Вот так:

import airplayer = require('airplayer');

export class AirplaySharing {
    constructor(public list: airplayer()) {
        list.on('update', function(player) {
            console.log('Found new AirPlay device:', player.name);
        });
    }
}

Надеюсь, что поможет :)

22
задан einpoklum - reinstate Monica 18 March 2013 в 14:19
поделиться

2 ответа

Использовать Collection.containsAll () :

boolean isSubset = listA.containsAll(listB);
41
ответ дан 29 November 2019 в 04:36
поделиться

Во всех коллекциях есть метод containsAll.

2
ответ дан 29 November 2019 в 04:36
поделиться
Другие вопросы по тегам:

Похожие вопросы: