mirror of
https://github.com/vanitasvitae/Smack.git
synced 2025-12-15 15:31:08 +01:00
Fix minor codestyle issues
This commit is contained in:
parent
200f90ffdc
commit
cb18056613
422 changed files with 1404 additions and 1444 deletions
|
|
@ -413,7 +413,7 @@ public class Form {
|
|||
*/
|
||||
public void setInstructions(String instructions) {
|
||||
// Split the instructions into multiple instructions for each existent newline
|
||||
ArrayList<String> instructionsList = new ArrayList<String>();
|
||||
ArrayList<String> instructionsList = new ArrayList<>();
|
||||
StringTokenizer st = new StringTokenizer(instructions, "\n");
|
||||
while (st.hasMoreTokens()) {
|
||||
instructionsList.add(st.nextToken());
|
||||
|
|
@ -504,10 +504,8 @@ public class Form {
|
|||
if (field.getType() == FormField.Type.hidden) {
|
||||
// Since a hidden field could have many values we need to collect them
|
||||
// in a list
|
||||
List<String> values = new ArrayList<String>();
|
||||
for (String value : field.getValues()) {
|
||||
values.add(value);
|
||||
}
|
||||
List<String> values = new ArrayList<>();
|
||||
values.addAll(field.getValues());
|
||||
form.setAnswer(field.getVariable(), values);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,8 +141,8 @@ public class FormField implements NamedElement {
|
|||
private boolean required = false;
|
||||
private String label;
|
||||
private Type type;
|
||||
private final List<Option> options = new ArrayList<Option>();
|
||||
private final List<String> values = new ArrayList<String>();
|
||||
private final List<Option> options = new ArrayList<>();
|
||||
private final List<String> values = new ArrayList<>();
|
||||
private ValidateElement validateElement;
|
||||
|
||||
/**
|
||||
|
|
@ -196,7 +196,7 @@ public class FormField implements NamedElement {
|
|||
*/
|
||||
public List<Option> getOptions() {
|
||||
synchronized (options) {
|
||||
return Collections.unmodifiableList(new ArrayList<Option>(options));
|
||||
return Collections.unmodifiableList(new ArrayList<>(options));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -228,7 +228,7 @@ public class FormField implements NamedElement {
|
|||
*/
|
||||
public List<String> getValues() {
|
||||
synchronized (values) {
|
||||
return Collections.unmodifiableList(new ArrayList<String>(values));
|
||||
return Collections.unmodifiableList(new ArrayList<>(values));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -344,7 +344,7 @@ public class FormField implements NamedElement {
|
|||
*/
|
||||
protected void resetValues() {
|
||||
synchronized (values) {
|
||||
values.removeAll(new ArrayList<String>(values));
|
||||
values.removeAll(new ArrayList<>(values));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -73,9 +73,9 @@ public class DataForm implements ExtensionElement {
|
|||
private String title;
|
||||
private final List<String> instructions = new ArrayList<>();
|
||||
private ReportedData reportedData;
|
||||
private final List<Item> items = new ArrayList<Item>();
|
||||
private final List<Item> items = new ArrayList<>();
|
||||
private final Map<String, FormField> fields = new LinkedHashMap<>();
|
||||
private final List<Element> extensionElements = new ArrayList<Element>();
|
||||
private final List<Element> extensionElements = new ArrayList<>();
|
||||
|
||||
public DataForm(Type type) {
|
||||
this.type = type;
|
||||
|
|
@ -111,7 +111,7 @@ public class DataForm implements ExtensionElement {
|
|||
*/
|
||||
public List<String> getInstructions() {
|
||||
synchronized (instructions) {
|
||||
return Collections.unmodifiableList(new ArrayList<String>(instructions));
|
||||
return Collections.unmodifiableList(new ArrayList<>(instructions));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -131,7 +131,7 @@ public class DataForm implements ExtensionElement {
|
|||
*/
|
||||
public List<Item> getItems() {
|
||||
synchronized (items) {
|
||||
return Collections.unmodifiableList(new ArrayList<Item>(items));
|
||||
return Collections.unmodifiableList(new ArrayList<>(items));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -338,7 +338,7 @@ public class DataForm implements ExtensionElement {
|
|||
public static class ReportedData {
|
||||
public static final String ELEMENT = "reported";
|
||||
|
||||
private List<FormField> fields = new ArrayList<FormField>();
|
||||
private List<FormField> fields = new ArrayList<>();
|
||||
|
||||
public ReportedData(List<FormField> fields) {
|
||||
this.fields = fields;
|
||||
|
|
@ -350,7 +350,7 @@ public class DataForm implements ExtensionElement {
|
|||
* @return the fields returned from a search.
|
||||
*/
|
||||
public List<FormField> getFields() {
|
||||
return Collections.unmodifiableList(new ArrayList<FormField>(fields));
|
||||
return Collections.unmodifiableList(new ArrayList<>(fields));
|
||||
}
|
||||
|
||||
public CharSequence toXML() {
|
||||
|
|
@ -374,7 +374,7 @@ public class DataForm implements ExtensionElement {
|
|||
public static class Item {
|
||||
public static final String ELEMENT = "item";
|
||||
|
||||
private List<FormField> fields = new ArrayList<FormField>();
|
||||
private List<FormField> fields = new ArrayList<>();
|
||||
|
||||
public Item(List<FormField> fields) {
|
||||
this.fields = fields;
|
||||
|
|
@ -386,7 +386,7 @@ public class DataForm implements ExtensionElement {
|
|||
* @return the fields that define the data that goes with the item.
|
||||
*/
|
||||
public List<FormField> getFields() {
|
||||
return Collections.unmodifiableList(new ArrayList<FormField>(fields));
|
||||
return Collections.unmodifiableList(new ArrayList<>(fields));
|
||||
}
|
||||
|
||||
public CharSequence toXML() {
|
||||
|
|
|
|||
|
|
@ -148,7 +148,7 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
|
|||
|
||||
private static DataForm.Item parseItem(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||
final int initialDepth = parser.getDepth();
|
||||
List<FormField> fields = new ArrayList<FormField>();
|
||||
List<FormField> fields = new ArrayList<>();
|
||||
outerloop: while (true) {
|
||||
int eventType = parser.next();
|
||||
switch (eventType) {
|
||||
|
|
@ -172,7 +172,7 @@ public class DataFormProvider extends ExtensionElementProvider<DataForm> {
|
|||
|
||||
private static DataForm.ReportedData parseReported(XmlPullParser parser) throws XmlPullParserException, IOException {
|
||||
final int initialDepth = parser.getDepth();
|
||||
List<FormField> fields = new ArrayList<FormField>();
|
||||
List<FormField> fields = new ArrayList<>();
|
||||
outerloop: while (true) {
|
||||
int eventType = parser.next();
|
||||
switch (eventType) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue