// Path: src/main/java/org/fest/util/Lists.java
// public static @NotNull <T> List<T> emptyList() {
//   return Collections.emptyList();
// }
// 
// Path: src/main/java/org/fest/util/Sets.java
// public static @NotNull <T> HashSet<T> newHashSet() {
//   return new HashSet<T>();
// }
// 
// Path: src/main/java/org/fest/util/ToString.java
// public static @Nullable String toStringOf(@Nullable Object o) {
//   if (isArray(o)) {
//     return Arrays.format(o);
//   }
//   if (o instanceof Calendar) {
//     return toStringOf(o);
//   }
//   if (o instanceof Class<?>) {
//     return toStringOf((Class<?>) o);
//   }
//   if (o instanceof Collection<?>) {
//     return toStringOf((Collection<?>) o);
//   }
//   if (o instanceof Date) {
//     return toStringOf(o);
//   }
//   if (o instanceof Float) {
//     return toStringOf((Float) o);
//   }
//   if (o instanceof Long) {
//     return toStringOf((Long) o);
//   }
//   if (o instanceof File) {
//     return toStringOf((File) o);
//   }
//   if (o instanceof Map<?, ?>) {
//     return toStringOf((Map<?, ?>) o);
//   }
//   if (o instanceof String) {
//     return quote((String) o);
//   }
//   if (o instanceof Comparator) {
//     return toStringOf((Comparator<?>) o);
//   }
//   return o == null ? null : o.toString();
// }


import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import static org.fest.util.Lists.emptyList;
import static org.fest.util.Sets.newHashSet;
import static org.fest.util.ToString.toStringOf;
/*
 * Created on Apr 29, 2007
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 *
 * Copyright @2007-2013 the original author or authors.
 */
package org.fest.util;




/**
 * Utility methods related to {@code Collection}s.
 *
 * @author Yvonne Wang
 * @author Alex Ruiz
 * @author Joel Costigliola
 */
public final class Collections {
  private Collections() {
  }

  /**
   * Returns any duplicate elements from the given {@code Collection}.
   *
   * @param <T> the generic type of the given {@code Collection}.
   * @param c   the given {@code Collection} that might have duplicate elements.
   * @return a {@code Collection} containing the duplicate elements of the given one. If the given {@code Collection} is
   *         {@code null} or if no duplicates were found, an empty {@code Collection} is returned.
   */
  public static @NotNull <T> Collection<T> duplicatesFrom(@Nullable Collection<T> c) {
    Set<T> duplicates = new LinkedHashSet<T>();
    if (c == null) {
      return duplicates;
    }
// Path: src/main/java/org/fest/util/Lists.java
// public static @NotNull <T> List<T> emptyList() {
//   return Collections.emptyList();
// }
// 
// Path: src/main/java/org/fest/util/Sets.java
// public static @NotNull <T> HashSet<T> newHashSet() {
//   return new HashSet<T>();
// }
// 
// Path: src/main/java/org/fest/util/ToString.java
// public static @Nullable String toStringOf(@Nullable Object o) {
//   if (isArray(o)) {
//     return Arrays.format(o);
//   }
//   if (o instanceof Calendar) {
//     return toStringOf(o);
//   }
//   if (o instanceof Class<?>) {
//     return toStringOf((Class<?>) o);
//   }
//   if (o instanceof Collection<?>) {
//     return toStringOf((Collection<?>) o);
//   }
//   if (o instanceof Date) {
//     return toStringOf(o);
//   }
//   if (o instanceof Float) {
//     return toStringOf((Float) o);
//   }
//   if (o instanceof Long) {
//     return toStringOf((Long) o);
//   }
//   if (o instanceof File) {
//     return toStringOf((File) o);
//   }
//   if (o instanceof Map<?, ?>) {
//     return toStringOf((Map<?, ?>) o);
//   }
//   if (o instanceof String) {
//     return quote((String) o);
//   }
//   if (o instanceof Comparator) {
//     return toStringOf((Comparator<?>) o);
//   }
//   return o == null ? null : o.toString();
// }


// Path: src/main/java/org/fest/util/Collections.java
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
import static org.fest.util.Lists.emptyList;
import static org.fest.util.Sets.newHashSet;
import static org.fest.util.ToString.toStringOf;

/*
 * Created on Apr 29, 2007
 *
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
 * specific language governing permissions and limitations under the License.
 *
 * Copyright @2007-2013 the original author or authors.
 */
package org.fest.util;




/**
 * Utility methods related to {@code Collection}s.
 *
 * @author Yvonne Wang
 * @author Alex Ruiz
 * @author Joel Costigliola
 */
public final class Collections {
  private Collections() {
  }

  /**
   * Returns any duplicate elements from the given {@code Collection}.
   *
   * @param <T> the generic type of the given {@code Collection}.
   * @param c   the given {@code Collection} that might have duplicate elements.
   * @return a {@code Collection} containing the duplicate elements of the given one. If the given {@code Collection} is
   *         {@code null} or if no duplicates were found, an empty {@code Collection} is returned.
   */
  public static @NotNull <T> Collection<T> duplicatesFrom(@Nullable Collection<T> c) {
    Set<T> duplicates = new LinkedHashSet<T>();
    if (c == null) {
      return duplicates;
    }
    Set<T> unique = newHashSet();