]> git.basschouten.com Git - openhab-addons.git/blob
05d6829628870eb3912286618b921270d25714f0
[openhab-addons.git] /
1 /**
2  * Copyright (c) 2010-2023 Contributors to the openHAB project
3  *
4  * See the NOTICE file(s) distributed with this work for additional
5  * information.
6  *
7  * This program and the accompanying materials are made available under the
8  * terms of the Eclipse Public License 2.0 which is available at
9  * http://www.eclipse.org/legal/epl-2.0
10  *
11  * SPDX-License-Identifier: EPL-2.0
12  */
13 package org.openhab.binding.bosesoundtouch.internal.handler;
14
15 import java.util.Collection;
16 import java.util.Map;
17 import java.util.TreeMap;
18
19 import org.eclipse.jdt.annotation.NonNull;
20 import org.eclipse.jdt.annotation.NonNullByDefault;
21 import org.eclipse.jdt.annotation.Nullable;
22 import org.openhab.binding.bosesoundtouch.internal.ContentItem;
23 import org.openhab.core.storage.Storage;
24
25 /**
26  * @author Leo Siepel - Initial contribution
27  */
28 @NonNullByDefault
29 public class InMemmoryContentStorage implements Storage<ContentItem> {
30     Map<String, @Nullable ContentItem> items = new TreeMap<>();
31
32     public InMemmoryContentStorage() {
33     }
34
35     @Override
36     public @Nullable ContentItem put(String key, @Nullable ContentItem value) {
37         return items.put(key, value);
38     }
39
40     @Override
41     public @Nullable ContentItem remove(String key) {
42         return items.remove(key);
43     }
44
45     @Override
46     public boolean containsKey(String key) {
47         return items.containsKey(key);
48     }
49
50     @Override
51     public @Nullable ContentItem get(String key) {
52         return items.get(key);
53     }
54
55     @Override
56     public Collection<@NonNull String> getKeys() {
57         return items.keySet();
58     }
59
60     @Override
61     public Collection<@Nullable ContentItem> getValues() {
62         return items.values();
63     }
64 }