验证是否存在唯一字符串的组合

编程入门 行业动态 更新时间:2024-10-17 19:32:32
本文介绍了验证是否存在唯一字符串的组合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 class Details{ String name; String age; String email; String location; }

1)如果有中的详细信息列表列表<详细信息> 如何验证名称和电子邮件的组合是否唯一。 (即)对于单个电子邮件地址,不能有两个名称输入。

1) If there is List of Details as in List<Details> how to verify for a combination of name and email collectively unique. (i.e) For a single email address there cant be two name entry.

2)如何验证类文件中所有字段的组合是唯一的。

2) How to verify the combination of all fields in the class file is unique.

解决此问题的完美数据结构是什么?

what would be a perfect data structure to address this ?.

推荐答案

您可以通过#之类的分隔符来哈希值,然后找到所有uniques或不是。 详细信息的哈希值在第一种情况下为 name +#+email ,且为 name +#+ age +#+ email +#+ location 在第二种情况下。您可以使用 Hashmap 如果对于详细信息的每个实例都有指定的键(或散列),则查找重复项。

You can hash values by a separator like #, and then find that all uniques or not. Hash value for a Details is name + "#" + "email in the first case, and is name + "#" + age + "#" + email + "#" + location in the second case. You can using Hashmap to find duplicates if there is any with the specified key (or hash) for each instance of Details.

更多推荐

验证是否存在唯一字符串的组合

本文发布于:2023-11-29 12:35:14,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1646412.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:组合   字符串   是否存在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!