我想查看此功能的结果。 但无法修复声明错误!
//-------create class: Addgifts-----
export default class Addgifts extends Component{
constructor(){
super()
this.state={
value: [],
options: [],
staticOptions: [{ label: 'Chocolate', value: 'chocolate' },
{ label: 'Vanilla', value: 'vanilla' },
{ label: 'Strawberry', value: 'strawberry' },
]
}
}
//-------Handle options--------
handleOptions(){
let KeyWords = this.props.tags;
for (i=0 ; i<KeyWords.length ; i++){
return KeyWords[i].map.name((names)=>{
console.log(name);
return(
this.state.options.push({label:{name},value:{name}});
)
}
});
}
}
//-----Select Change----
handleSelectChange (value) {
console.log('You\'ve selected:', value);
this.setState({
value
});
}
//-----Select package----
<div>
<Select
multi={true}
value={this.state.value}
placeholder="Select all KeyWord(s)"
options={this.handleOptions()}
onChange={this.handleSelectChange.bind(this)} />
</div>
//-----subscribing tags from mongodb----
Addgifts.propTypes={tags: PropTypes.array.isRequired,};
export default createContainer(()=>{
Meteor.subscribe('tags');
return {gifts: Gifts.find({},{sort:{name:-1}}).fetch(),};
},Addgifts);
import java.util.HashMap; public class twosum { public int[] twoSum(int[] nums, int target) {
java:-source 1.3中不支持泛型 java:-source 1.3
中不支持菱形运算符
Map<Int, Int> map = new HashMap<>();
答案 0 :(得分:0)
尝试
Map<Integer, Integer> map = new HashMap<>();
或
Map<Integer, Integer> map = new HashMap<Integer, Integer>();