         removeFirstObject(object)
     }
 
-    /// EZSE: Removes the first given object
-    public mutating func removeFirstObject(_ object: Element) {
-        if let index = self.index(of: object) {
-            self.remove(at: index)
-        }
-    }
-
-    /// EZSE: Removes all occurrences of the given object
-    public mutating func removeObjects(_ object: Element) {
-        for i in self.indexes(of: object).reversed() {
-            self.remove(at: i)
-        }
-    }
-
-    /// EZSE: Checks if the main array contains the parameter array
-    @available(*, deprecated: 1.7, renamed: "contains(array:)")
-    public func containsArray(_ lookFor: [Element]) -> Bool {
-        return contains(array: lookFor)
-    }
-
-    /// EZSE: Checks if the main array contains the parameter array
-    public func contains(array lookFor: [Element]) -> Bool {
-        for item in lookFor {
-            if self.contains(item) == false {
-                return false
-            }
-        }
-        return true
-    }
-}
-
-public func ==<T: Equatable>(lhs: [T]?, rhs: [T]?) -> Bool {
-    switch (lhs, rhs) {
-    case (.some(let lhs), .some(let rhs)):
-        return lhs == rhs
-    case (.none, .none):
-        return true
-    default:
-        return false
-    }
-}
+}
+
+//MARK: - Deprecated 1.6
+
+extension Array {
+
+    /// EZSE: Iterates on each element of the array.
+    @available(*, deprecated: 1.6, renamed: "forEach(_:)")
+    public func each(_ call: (Element) -> ()) {
+        forEach(call)
+    }
+
+    /// EZSE: Creates an array with values generated by running each value of self
+    /// through the mapFunction and discarding nil return values.
+    @available(*, deprecated: 1.6, renamed: "flatMap(_:)")
+    public func mapFilter<V>(mapFunction map: (Element) -> (V)?) -> [V] {
+        return flatMap { map($0) }
+    }
+
+    /// EZSE: Iterates on each element of the array with its index.  (Index, Element)
+    @available(*, deprecated: 1.6, renamed: "forEachEnumerated(_:)")
+    public func each(_ call: @escaping (Int, Element) -> ()) {
+        forEachEnumerated(call)
+    }
+
+}

//
import UIKit

extension Array {
    /// EZSE: Returns a random element from the array.
    public func random() -> Element? {
        guard self.count > 0 else {
            return nil
        }

        let index = Int(arc4random_uniform(UInt32(self.count)))
        return self[index]
    }

    /// EZSE: Checks if array contains at least 1 instance of the given object type
    public func containsInstanceOf<T>(_ object: T) -> Bool {
        for item in self {
            if type(of: item) == type(of: object) {
                return true
            }
        }
        return false
    }

    /// EZSE: Checks if test returns true for all the elements in self
    public func testAll(_ test: (Element) -> Bool) -> Bool {
        for item in self {
            if !test(item) {
                return false
            }
        }
        return true
    }

    /// EZSE: Checks if all elements in the array are true of false
    public func testIfAllIs(_ condition: Bool) -> Bool {
        for item in self {
            guard let item = item as? Bool else { return false }

            if item != condition {
                return false
            }
        }
        return true
    }

    /// EZSE: Gets the object at the specified index, if it exists.
    public func get(_ index: Int) -> Element? {
        return index >= 0 && index < count ? self[index] : nil
    }

    /// EZSE: Reverse the given index. i.g.: reverseIndex(2) would be 2 to the last

        return Swift.max(self.count - 1 - index, 0)
    }

    /// EZSE: Shuffles the array in-place using the Fisher-Yates-Durstenfeld algorithm.
    public mutating func shuffle() {
        guard self.count > 1 else { return }
        var j: Int
        for i in 0..<(self.count-2) {
            j = Int(arc4random_uniform(UInt32(self.count - i)))
            if i != i+j { swap(&self[i], &self[i+j]) }
        }
    }

    /// EZSE: Shuffles copied array using the Fisher-Yates-Durstenfeld algorithm, returns shuffled array.
    public func shuffled() -> Array {
        var result = self
        result.shuffle()
        return result
    }

    /// EZSE: Returns an array with the given number as the max number of elements.
    public func takeMax(_ n: Int) -> Array {
        return Array(self[0..<Swift.max(0, Swift.min(n, count))])
    }

    /// EZSE: Checks if test returns true for all the elements in self
    public func testAll(_ body: @escaping (Element) -> Bool) -> Bool {
        return self.first { !body($0) } == nil
    }

    /// EZSE: Checks if all elements in the array are true or false
    public func testAll(is condition: Bool) -> Bool {
        return testAll { ($0 as? Bool) ?? !condition == condition }
    }

}

extension Array where Element: Equatable {

    /// EZSE: Checks if the main array contains the parameter array
    public func contains(_ array: [Element]) -> Bool {
        return array.testAll { self.index(of: $0) ?? -1 >= 0 }
    }

    /// EZSE: Checks if self contains a list of items.
    public func contains(_ elements: Element...) -> Bool {
        return elements.testAll { self.index(of: $0) ?? -1 >= 0 }
    }

    /// EZSE: Returns the indexes of the object
    public func indexes(of element: Element) -> [Int] {
        return self.enumerated().flatMap { ($0.element == element) ? $0.offset : nil }
    }

    /// EZSE: Returns the last index of the object
    public func lastIndex(of element: Element) -> Int? {
        return indexes(of: element).last
    }

    /// EZSE: Removes the first given object
    public mutating func removeFirst(_ element: Element) {
        guard let index = self.index(of: element) else { return }
        self.remove(at: index)
    }

    // EZSE: Removes all occurrences of the given object
    public mutating func removeAll(_ objects: Element...) {
        for object in objects {
            for i in self.indexes(of: object).reversed() {
                self.remove(at: i)
            }
        }
    }

    /// EZSE: Difference of self and the input arrays.
