activemq-cpp-3.9.5
Collections.h
Go to the documentation of this file.
1/*
2 * Licensed to the Apache Software Foundation (ASF) under one or more
3 * contributor license agreements. See the NOTICE file distributed with
4 * this work for additional information regarding copyright ownership.
5 * The ASF licenses this file to You under the Apache License, Version 2.0
6 * (the "License"); you may not use this file except in compliance with
7 * the License. You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17
18#ifndef _DECAF_UTIL_COLLECTIONS_H_
19#define _DECAF_UTIL_COLLECTIONS_H_
20
21#include <decaf/util/Config.h>
22
24#include <decaf/util/Iterator.h>
26#include <decaf/util/List.h>
27#include <decaf/lang/Pointer.h>
28
29#include <vector>
30#include <memory>
31
32namespace decaf {
33namespace util {
34
35 class DECAF_API Collections {
36 private:
37
38 Collections();
39 Collections(const Collections&);
40 Collections& operator= (const Collections&);
41
42 public:
43
52 template<typename E>
53 static void reverse(List<E>& list) {
54 int size = list.size();
57
58 for (int i = 0; i < size / 2; i++) {
59 E frontNext = front->next();
60 E backPrev = back->previous();
61 front->set(backPrev);
62 back->set(frontNext);
63 }
64 }
65
66 };
67
68}}
69
70#endif /* _DECAF_UTIL_COLLECTIONS_H_ */
Decaf's implementation of a Smart Pointer that is a template on a Type and is Thread Safe if the defa...
Definition Pointer.h:53
virtual int size() const =0
Returns the number of elements in this collection.
static void reverse(List< E > &list)
Modifies the specified List by reversing the order of the elements.
Definition Collections.h:53
An ordered collection (also known as a sequence).
Definition List.h:47
virtual ListIterator< E > * listIterator()=0
#define DECAF_API
Definition Config.h:29
Definition AbstractCollection.h:33
Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.
Definition AprPool.h:25