Open In App

Convert Set of String to Array of String in Java

Given a Set of Strings, the task is to convert the Set into an Array of Strings in Java.

Examples:



Input: Set<String>: ["ForGeeks", "A Computer Portal", "Geeks"]
Output: String[]: ["ForGeeks", "A Computer Portal", "Geeks"]

Input: Set<String>: ["G", "e", "k", "s"]
Output: String[]: ["G", "e", "k", "s"]

Article Tags :