teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

2

記述漏れ

2017/07/13 10:49

投稿

omodai
omodai

スコア10

title CHANGED
File without changes
body CHANGED
@@ -119,7 +119,7 @@
119
119
  sectionList.add(new Section("A", "あああ"));
120
120
  sectionList.add(new Section("C", "ううう"));
121
121
  sectionList.add(new Section("D", "えええ"));
122
- sectionList.add(new Section("B", "いいい"));
122
+ sectionList.add(new Section("B", "ううう"));
123
123
 
124
124
 
125
125
  System.out.println("sectionListをループ");
@@ -150,13 +150,13 @@
150
150
  Section{sectionCode=A, sectionName=あああ}
151
151
  Section{sectionCode=C, sectionName=ううう}
152
152
  Section{sectionCode=D, sectionName=えええ}
153
- Section{sectionCode=B, sectionName=いいい}
153
+ Section{sectionCode=B, sectionName=ううう}
154
154
  -------------------------------------------------------
155
155
  -------------------------------------------------------
156
156
  -------------------------------------------------------
157
157
  sectionListをsectionNameでソートしてからループ
158
158
  Section{sectionCode=A, sectionName=あああ}
159
- Section{sectionCode=B, sectionName=いいい}
159
+ Section{sectionCode=B, sectionName=ううう}
160
160
  Section{sectionCode=C, sectionName=ううう}
161
161
  Section{sectionCode=D, sectionName=えええ}
162
162
  ```
@@ -181,7 +181,7 @@
181
181
  infoList.add(new Info(new Person("taro", "yamada", 30), new Section("A", "あああ")));
182
182
  infoList.add(new Info(new Person("sachiko", "sato", 28), new Section("C", "ううう")));
183
183
  infoList.add(new Info(new Person("ichiro", "suzuki", 40), new Section("D", "えええ")));
184
- infoList.add(new Info(new Person("Eri", "ito", 20), new Section("B", "いいい")));
184
+ infoList.add(new Info(new Person("Eri", "ito", 20), new Section("B", "ううう")));
185
185
 
186
186
  for (Info info : infoList) {
187
187
  System.out.println(info.getPerson().toString());
@@ -206,7 +206,7 @@
206
206
  Section{sectionCode=D, sectionName=えええ}
207
207
  -------------------------------------------------------
208
208
  Person{firstName=Eri, lastName=ito, age=20}
209
- Section{sectionCode=B, sectionName=いいい}
209
+ Section{sectionCode=B, sectionName=ううう}
210
210
  -------------------------------------------------------
211
211
  ```
212
212
 
@@ -218,7 +218,7 @@
218
218
  Section{sectionCode=A, sectionName=あああ}
219
219
  -------------------------------------------------------
220
220
  Person{firstName=Eri, lastName=ito, age=20}
221
- Section{sectionCode=B, sectionName=いいい}
221
+ Section{sectionCode=B, sectionName=ううう}
222
222
  -------------------------------------------------------
223
223
  Person{firstName=sachiko, lastName=sato, age=28}
224
224
  Section{sectionCode=C, sectionName=ううう}

1

やりたいことの記述抜け

2017/07/13 10:49

投稿

omodai
omodai

スコア10

title CHANGED
File without changes
body CHANGED
@@ -163,7 +163,7 @@
163
163
 
164
164
  ###はまっているところ
165
165
 
166
- 以下のようにInfoオブジェクトの中にあるSectionオブジェクトのフィールドでソートしたい場合はどうするのがいいのでしょうか?
166
+ 以下のようにInfoオブジェクトの中にあるSectionオブジェクトの複数フィールドでソートしたい場合はどうするのがいいのでしょうか?
167
167
 
168
168
  ```java
169
169
  package sorttest;
@@ -211,6 +211,7 @@
211
211
  ```
212
212
 
213
213
  * SectionのsectionNameでソートして以下のようにしたい
214
+ * **追記・・・**sectionNameだけでなくsectionCodeと合わせてソートするにはどうすればいいでしょうか?
214
215
 
215
216
  ```
216
217
  Person{firstName=taro, lastName=yamada, age=30}