Generic ArrayList derangement solution completed with tests