首页 \ 问答 \ 与collections.sort绑定不匹配(Bound Mismatch with collections.sort)

与collections.sort绑定不匹配(Bound Mismatch with collections.sort)

我有一个具有sqlite DB的应用程序,其内容被放入arraylist并可通过列表视图查看。 我的问题是我无法按字母顺序获取该项目。 我已经实现了Collections.sort()但是收到了Bound Mismatch错误。 有任何想法吗

错误:

绑定不匹配:类型Collections的泛型方法sort(List<T>)不适用于参数(ArrayList<LoginDetails>) 。 推断类型LoginDetails不是有界参数的有效替代<T extends Comparable<? super T>> <T extends Comparable<? super T>>

private ListView loginList;
private Button webLogin;
private ListAdapter loginListAdapter;
private ArrayList<LoginDetails> loginArrayList;

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.login_listview);


    loginList = (ListView)
    findViewById(R.id.loginlist);
    loginList.setOnItemClickListener(this);

    webLogin = (Button)
    findViewById(R.id.button3);
    webLogin.setOnClickListener(this);

    loginArrayList = new ArrayList<LoginDetails>();
    loginListAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, populateList());
    loginList.setAdapter(loginListAdapter);

    Collections.sort(loginArrayList ); //Bound mismatch error is here.
    }

登录详细信息:

public class LoginDetails {

private String sName;
private String wUrl;
private String uName;
private String pWord;

public String getsName() {
return sName;
}
public void setsName(String sName) {
this.sName = sName;
}

public String getwUrl() {
return wUrl;
}
public void setwUrl(String wUrl) {
this.wUrl = wUrl;
}

public String getuName() {
return uName;
}
public void setuName(String uName) {
this.uName = uName;
}
public String getpWord() {
return pWord;
}
public void setpWord(String pWord) {
this.pWord = pWord;
}

}

I have a application that has a sqlite DB whos content is put into an arraylist and viewable through a list view. My issue is that I am unable to get the item in alphabetical order. I have implemented Collections.sort() but receive a Bound Mismatch error. any ideas

Error:

Bound mismatch: The generic method sort(List<T>) of type Collections is not applicable for the arguments (ArrayList<LoginDetails>). The inferred type LoginDetails is not a valid substitute for the bounded parameter <T extends Comparable<? super T>>

private ListView loginList;
private Button webLogin;
private ListAdapter loginListAdapter;
private ArrayList<LoginDetails> loginArrayList;

    public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.login_listview);


    loginList = (ListView)
    findViewById(R.id.loginlist);
    loginList.setOnItemClickListener(this);

    webLogin = (Button)
    findViewById(R.id.button3);
    webLogin.setOnClickListener(this);

    loginArrayList = new ArrayList<LoginDetails>();
    loginListAdapter = new ArrayAdapter<String>(this, android.R.layout.simple_list_item_1, populateList());
    loginList.setAdapter(loginListAdapter);

    Collections.sort(loginArrayList ); //Bound mismatch error is here.
    }

LoginDetails:

public class LoginDetails {

private String sName;
private String wUrl;
private String uName;
private String pWord;

public String getsName() {
return sName;
}
public void setsName(String sName) {
this.sName = sName;
}

public String getwUrl() {
return wUrl;
}
public void setwUrl(String wUrl) {
this.wUrl = wUrl;
}

public String getuName() {
return uName;
}
public void setuName(String uName) {
this.uName = uName;
}
public String getpWord() {
return pWord;
}
public void setpWord(String pWord) {
this.pWord = pWord;
}

}

原文:https://stackoverflow.com/questions/11651120
更新时间:2023-03-11 11:03

最满意答案

Hadoop实际上有一个故障注入框架。 看到这个


Hadoop actually has a fault injection framework. See this.

相关问答

更多
  • hadoop 运行问题[2021-09-25]

    解决方案: 1. 格式化namenode: # hadoop namenode -format 2. 重新启动hadoop# sh stop-all.sh# sh start-all.sh 3. 查看后台进程# jps13508 NameNode11008 SecondaryNameNode14393 Jps11096 JobTracker此时namenode启动 4. 运行# hadoop fs -ls12/01/31 14:04:39 INFO security.Groups: Group mappin ...
  • 你真的需要一个更好的“大”的定义。 “大”是一个愿望,还是你的营销部门*认为他们会拥有硬数据? 如果你可以使用简单的组件来做到这一点,那就做吧。 Cassandra和Hadoop之类的软件既不容易安装(特别是后者)或开发; 那些能够有效开发这样的应用程序的开发人员将非常昂贵且难以雇佣。 所以我想说,首先使用您最喜欢的“传统”数据库和适当的高可用性解决方案,然后等待,直到您接近极限(您可以始终测量实际应用程序的限制位置,一旦建立你有一个性能测试系统)。 请记住,堆栈溢出使用非常传统的组件,只需使用少量的商品硬 ...
  • 也许。 但是他们中没有一个会在测试中接近hadoop的真实世界体验。 像Facebook和雅虎这样的公司正在付钱来规模hadoop,我也知道没有类似的开源项目值得期待。 Maybe. But none of them will have anywhere near the testing a real world experience that hadoop does. Companies like facebook and yahoo are paying to scale hadoop and I kn ...
  • 假设zipIn是java.util.zip.ZipInputStream ,你不应该迭代地调用getNextEntry而不是读取字节吗? I resolved this issue after doing some changes in my code. In the first part of code, I was trying to unzip all the zip files whereas I should have access the spilts. Hadoop basic, which ...
  • Hadoop实际上有一个故障注入框架。 看到这个 。 Hadoop actually has a fault injection framework. See this.
  • 点击此链接,在ubuntu上安装hadoop 0.23.9 。 但是对于hadoop 2.2.0也是如此。 尝试一下 Follow this link for hadoop 0.23.9 installation on ubuntu. But is same for hadoop 2.2.0. try it
  • 请参阅org.apache.hadoop.examples.Sort 使用map / reduce并不是非常简单。 它涉及获取数据的直方图并使用TotalOrderPartitioner 。 或者,您可以使用Hive或Pig,它具有内置的排序功能。 See org.apache.hadoop.examples.Sort This is not super-straightforward to do using map/reduce. It involves taking a histogram of you ...
  • 在启动项目中注册所有内容实际上是一件好事。 这个常见的地方称为组合根 ,它允许您最小化项目之间的引用数量,如此处所述。 你应该防止的另一件事是让你的代码(除了你的组合根之外的任何东西)依赖于DI库或对你的DI库的抽象。 因此,不要从构造函数内部调用Resolve ,而是将类的任何依赖项注入到该类的构造函数中。 例: public class Account { private readonly IEmailer emailer; public Account(IEmailer emaile ...
  • 如果你正在使用cloudera发行版,那么它很可能在/usr/lib/hadoop ,否则它可能在任何地方(由你的系统管理员决定)。 您可以使用一些技巧来尝试找到它: locate hadoop-env.sh (假设已经安装了locate并且最近已经运行了updatedb) 如果你运行它的机器正在运行hadoop服务(例如数据节点,作业跟踪器,任务跟踪器,名称节点),那么你可以执行一个进程列表和grep for hadoop命令: ps axww | grep hadoop ps axww | grep h ...
  • 这里有很好的解释。 https://hadoopi.wordpress.com/2013/05/27/understand-recordreader-inputsplit/ 而且在这里 https://github.com/apache/hadoop/blob/trunk/hadoop-mapreduce-project/hadoop-mapreduce-client/hadoop-mapreduce-client-core/src/main/java/org/apache/hadoop/mapred/L ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)