in Swift: Difference between Array VS NSArray VS [AnyObject]

Array is a struct, therefore it is a value type in Swift. NSArray is an immutable Objective C class, therefore it is a reference type in Swift and it is bridged to Array<AnyObject>. NSMutableArray is the mutable subclass of NSArray. var arr : NSMutableArray = [“Pencil”, “Eraser”, “Notebook”] var barr = [“Pencil”, “Eraser”, “Notebook”] func … Read more

What’s the sort order of Java’s Collections.sort(list, comparator)? small to big or big to small?

The sort order is always ascending, where the Comparator defines which items are larger than others. From the documentation for Collections.sort(List<T> list, Comparator<? super T> c): Sorts the specified list according to the order induced by the specified comparator. From the documentation for Comparator.compare(T,T): Compares its two arguments for order. Returns a negative integer, zero, … Read more

What is the difference between the properties Keys and AllKeys on a NameValueCollection?

AllKeys is an O(n) operation, while Keys is O(1). This is because AllKeys copies the keys into a new array, while Keys just returns a reference to NameValueCollection‘s private key collection. So beyond the difference in performance, the collection returned by Keys will change with the base collection as it’s just a reference to the … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)